Product Categories¶
This page documents how to use the manager and record objects for product categories.
Details¶
Name | Value |
---|---|
Odoo Modules | Product, Accounting |
Odoo Model Name | product.category |
Manager | product_categories |
Record Type | ProductCategory |
Manager¶
The product category manager is available as the product_categories
attribute on the Odoo client object.
>>> from openstack_odooclient import Client as OdooClient
>>> odoo_client = OdooClient(
... hostname="localhost",
... port=8069,
... protocol="jsonrpc",
... database="odoodb",
... user="test-user",
... password="<password>",
... )
>>> odoo_client.product_categories.get(1234)
ProductCategory(record={'id': 1234, ...}, fields=None)
For more information on how to use managers, refer to Managers.
Record¶
The product category manager returns ProductCategory
record objects.
To import the record class for type hinting purposes:
The record class currently implements the following fields and methods.
For more information on attributes and methods common to all record types, see Record Attributes and Methods.
child_id
¶
A list of IDs for the child categories.
child_ids
¶
An alias for child_id
.
children
¶
The list of child categories.
This fetches the full records from Odoo once, and caches them for subsequent accesses.
complete_name
¶
The complete product category tree.
name
¶
Name of the product category.
parent_id
¶
The ID for the parent product category, if this category is the child of another category.
parent_id
¶
The name of the parent product category, if this category is the child of another category.
parent
¶
The parent product category, if this category is the child of another category.
This fetches the full record from Odoo once, and caches it for subsequent accesses.
parent_path
¶
The path of the parent product category, if there is a parent.
product_count
¶
The number of products under this category.