Skip to content

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:

from openstack_odooclient import ProductCategory

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

child_id: list[int]

A list of IDs for the child categories.

child_ids

child_ids: list[int]

An alias for child_id.

children

children: list[ProductCategory]

The list of child categories.

This fetches the full records from Odoo once, and caches them for subsequent accesses.

complete_name

complete_name: str

The complete product category tree.

name

name: str

Name of the product category.

parent_id

parent_id: int | None

The ID for the parent product category, if this category is the child of another category.

parent_id

parent_name: str | None

The name of the parent product category, if this category is the child of another category.

parent

parent: ProductCategory | None

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

parent_path: str | Literal[False]

The path of the parent product category, if there is a parent.

product_count

product_count: int

The number of products under this category.