Product Class

product_class
REPOSITORY
REPOSITORYOCA/product-attribute
GIT
GIThttps://github.com/OCA/product-attribute.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/product-attribute/tree/19.0/product_class
VERSION
VERSION 1.0.0
CATEGORY
CATEGORYProduct
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSWeblate, OCA-git-bot, oca-ci, Ricardoalso
WEBSITE
WEBSITEhttps://github.com/OCA/product-attribute
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 19:40:48
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - product
    - base
    - mail
    - base_setup
    - web
    - bus
    - web_tour
    - html_editor
    - uom
    - stock
    - barcodes_gs1_nomenclature
    - barcodes
    - digest
    - portal
    - http_routing
    - auth_signup
    - resource
    - sale
    - sales_team
    - account_payment
    - account
    - onboarding
    - analytic
    - payment
    - utm
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION
## Product Class

This module introduces **Product Classes** for standardizing product setup and attribute management. It allows you to:

1. **Define Product Classes** — Group related products into classes (e.g., "Furniture", "Electronics")
2. **Constrain Attributes per Class** — Specify which attributes are allowed for each class
3. **Mark Required Attributes** — Designate certain attributes as mandatory for products in that class
4. **Enforce Validation** — Prevent products from using attributes outside their class or missing required attributes

### Key Features

- **Bridge Model (`product.class.attribute.line`)** — Manages the relationship between classes and attributes, storing both allowed attributes and a `required` flag
- **Strict Validation** — Products assigned to a class must:
  - Use only attributes defined in that class
  - Provide values for all required attributes
- **UI Enforcement** — Attribute selection in product forms is restricted by the class domain filter
- **Management Views** — Full CRUD interface for product classes (Inventory > Configuration > Product Classes, Sales > Configuration > Product Classes)

### Technical Architecture

- `product.class` — Main product classification model
- `product.class.attribute.line` — Bridge model linking classes to attributes with a `required` flag
- `product.attribute` (inherited) — Extended with reverse one-to-many to track which classes use it
- `product.template` (inherited) — Added class validation and computed required-attribute tracking

Code Analysis

Views touched (5)
XML IDNameModelTypeStatus
product_attribute_view_form product.attribute xpath Inherits product.product_attribute_view_form
product_class_form product.class form New
product_class_list product.class list New
product_class_search product.class search New
product_template_form_view product.template xpath Inherits product.product_template_only_form_view
Models touched (4)

New fields (2)
  • class_attribute_line_ids One2many → product.class.attribute.line
    comodel_name='product.class.attribute.line' help='Product classes that include this attribute.' inverse_name='attribute_id' string='Class Attribute Lines'
  • classes_count Integer
    compute='_compute_classes_count' string='Product Classes Count'
Public methods (1)
  • action_open_product_classes(self)

New fields (3)
  • active Boolean
    default=True
  • attribute_line_ids One2many → product.class.attribute.line
    comodel_name='product.class.attribute.line' help='Allowed attributes for products of thisclass and whether they are required.' inverse_name='class_id' string='Attributes'
  • name Char
    translate=True
Public methods (0)

No public methods.

New fields (3)
  • attribute_id Many2one → product.attribute
    comodel_name='product.attribute' index=True ondelete='restrict' required=True string='Attribute'
  • class_id Many2one → product.class
    comodel_name='product.class' index=True ondelete='cascade' required=True string='Product Class'
  • required Boolean
    default=False help='If enabled, products of this class must define this attribute.'
Public methods (0)

No public methods.

New fields (3)
  • class_attribute_ids Many2many → product.attribute
    comodel_name='product.attribute' compute='_compute_class_attribute_ids' help='Attributes allowed by the selected product class' string='Class Attributes'
  • class_id Many2one → product.class
    comodel_name='product.class' help='Product class that constrains which attributes can be used' string='Product Class'
  • class_required_attribute_ids Many2many → product.attribute
    comodel_name='product.attribute' compute='_compute_class_attribute_ids' help='Required attributes for the selected product class.' string='Class Required Attributes'
Public methods (0)

No public methods.