Products - Compute Technical Fields (template from Variant)
This module extends the functionality of product module, introducing a technical helper to define easily template fields that are computed from variant values.
auto_awesome What this module does
AI-generated from the code · Odoo 16.0This module adds a technical helper that automatically copies values like barcode, weight, or volume between a product template and its single variant, and sets a default when there are multiple or no variants.
This module is a technical helper for developers. It does not add any new screens, menus, or buttons. Instead, it provides two methods on the product template model (product.template) that other modules can use to compute or propagate field values between a product template and its variants.
The first method, _compute_template_field_from_variant_field, sets a field on the template based on the value of the same field on its variants. If the template has exactly one variant, the template field is set to that variant's value. If there are no variants, it tries again ignoring archived variants. If there are multiple variants, it sets the field to a default value (which can be specified). This is useful for fields like barcode, weight, or volume that are often the same across a single-variant product.
The second method, _set_product_variant_field, does the opposite: it propagates a field value from the template to its unique variant. If the template has exactly one variant, that variant's field is set to the template's value. If there are no active variants but one archived variant, that archived variant is updated.
These methods are meant to be called by other modules to avoid duplicating logic. They do not change any behaviour on their own; they only provide reusable functions. The module depends on the standard product module and extends the product.template model.
Depends on
Required by other modules
Models and fields (1)
- product.template · extends an existing model
Text generated by AI (DeepSeek) from reading the Odoo 16.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub
Availability by version
Reviewed: 2026-11-03Confirmation status: 1 confirmed, 8 with no information of 9 versions.
Sources · Odoo 16.0
Confirmed on 2026-11-03 in branch 16.0 of OCA/product-attribute.
terminal Installation and usage
No verified informationInstallation instructions, the distribution package, dependencies and configuration steps are not shown because they have not yet been verified in the module documentation for any version.
Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.