Repository
OCA/product-variant · module folder · Try on Runboat
Module version
1.0.0
Category
Product
Folder size
0.21 MB
License
AGPL-3
Application
No
Auto-installable
No
Website
https://github.com/OCA/product-variant
Last tracking update
2026-08-07 09:06:27
Authors
Akretion, Odoo Community Association (OCA), Tecnativa, AvancOSC, Shine IT
Maintainers
Akretion, Odoo Community Association (OCA), Tecnativa, AvancOSC, Shine IT
Committers
Weblate, OCA-git-bot, oca-ci, arantxa-s73
Odoo dependencies
odoo/odoo:
- web
- bus
- uom
Python dependencies
None
System dependencies
None
Required by
None
Description
This module automatically generate Product Reference (default_code)
according to attributes data with a configurable behavior.

It defines a reference mask on the product templates so the variants
references are automatically set. For example:

- Product template: Jacket
- Attributes:
  - Color: White, Black
  - Size: M, L
- Reference mask: JKT01-\[Color\]-\[Size\]
- Reference on variants:
  - JKT01-Wh-M Jacket White M
  - JKT01-Bl-M Jacket Black M
  - JKT01-Wh-L Jacket White L
  - JKT01-Bl-L Jacket Black L

Code Analysis

Views touched (7)
XML IDNameModelTypeStatus
attribute_tree_view product.attribute tree Inherits product.attribute_tree_view
product_normal_form_view product.product form Inherits product.product_normal_form_view
product_template_only_form_view product.template form Inherits product.product_template_only_form_view
product_variant_easy_edit_view product.product Inherits product.product_variant_easy_edit_view
view_general_configuration res.config.settings form Inherits base_setup.res_config_settings_view_form
view_product_attribute_form product.attribute form Inherits product.product_attribute_view_form
view_product_attribute_search product.attribute search New
HTTP endpoints (0)

No HTTP endpoints found for this module.

Models touched (5)

New fields (1)
  • code Char
    string='Attribute Code'
Public methods (0)

No public methods.

New fields (1)
  • code Char
    compute='_compute_code' readonly=False store=True string='Attribute Value Code'
Public methods (0)

No public methods.

New fields (2)
  • default_code Char
    compute='_compute_default_code' inverse='_inverse_default_code' readonly=False store=True
  • manual_code Boolean
    default=False string='Manual Reference'
Public methods (0)

No public methods.

New fields (3)
  • code_prefix Char
    help='Add prefix to product variant reference (default code)' string='Reference Prefix'
  • reference_mask Char
    compute='_compute_reference_mask' copy=False help='Reference mask for building internal references of a variant generated from this template.\nExample:\nA product named ABC with 2 attributes: Size and Color:\nProduct: ABC\nColor: Red(r), Yellow(y), Black(b) #Red, Yellow, Black are the attribute value, `r`, `y`, `b` are the corresponding code\nSize: L (l), XL(x)\nWhen setting Variant reference mask to `[Color]-[Size]`, the default code on the variants will be something like `r-l` `b-l` `r-x` ...\nIf you like, You can even have the attribute name appear more than once in the mask. Such as,`fancyA/[Size]~[Color]~[Size]`\n When saved, the default code on variants will be something like \n `fancyA/l~r~l` (for variant with Color "Red" and Size "L") `fancyA/x~y~x` (for variant with Color "Yellow" and Size "XL")\nNote: make sure characters "[,]" do not appear in your attribute name' inverse='_inverse_reference_mask' store=True string='Variant reference mask'
  • variant_default_code_error Text
    compute='_compute_variant_default_code_error'
Public methods (2)
  • create(self, vals_list)
    @api.model_create_multi
  • is_automask(self)

New fields (2)
  • group_product_default_code_manual_mask Boolean
    default=False help='Set behaviour of codes. Default: Automask (depends on variant use: see Sales/Purchases configuration)' implied_group='product_variant_default_code.group_product_default_code_manual_mask' string='Product Default Code Manual Mask'
  • prefix_as_default_code Boolean
    config_parameter='product_variant_default_code.prefix_as_default_code' default=False string='Reference Prefix as default Reference'
Public methods (0)

No public methods.

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…