Package: odoo14-addon-product-variant-default-code
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: JacketAttributes:
- Color: White, Black
- Size: M, LReference mask:JKT01-[Color]-[Size]Reference on variants:JKT01-Wh-MJacket White MJKT01-Bl-MJacket Black MJKT01-Wh-LJacket White LJKT01-Bl-LJacket Black LTable of contentsUsageAvoiding mask in variantsKnown issues / RoadmapBug TrackerCreditsAuthorsContributorsMaintainersUsageTo set the reference mask up on any product template ‘Variant reference mask’
new field.When creating a new product template without specifying theVariant reference
mask, a default value forVariant reference maskwill be automatically
generated according to the attribute line settings on the product template (if
any). The mask will then be used as an instruction to generate default code of
each product variant of the product template with the correspondingAttribute
Code(of the attribute value) inserted. Besides the default value,Variant
reference maskcan be configured to your liking, make sure putting theAttribute Nameinside[]marks (it is case sensitive).Example:Creating a product namedJacketwith two attributes,SizeandColor:Product: Jacket
Color: Black(Bl), White(Wh) # Black and White are the attribute values;
                              'Bl' and 'Wh' are the corresponding codes
Size: L (L), XL(XL)The automatically generated default value for the Variant reference mask will
be[Color]-[Size]and so the ‘default code’ on the variants will beBl-L,Wh-L,Bl-XLandWh-XL.The mask value can be fully customized whatever you like. You can even have
the attribute name appear more than once in the mask such as,Jacket/[Size]~[Color]~[Size], and the generated code on variants will be
something likeJacket/L~Bl~L(for variant with Color “Black” and Size “L”).When the code attribute is changed, it automatically regenerates the ‘default
code’ on all variants affected.Aditionally, a product attribute can be set and so it will be appended to the
productdefault_code. In the first example, setting aColorcode toCOwould givedefault_codelike this:COBl-L,COWh-L,COBl-XLandCOWh-XL.Avoiding mask in variantsYou can avoid this behavior or force a manual default_code on variant. To do
so, go toProduct Variants > [any variant you want to set up]and set
manually its reference code. The fieldmanual codewill be set to on and the
variant internal reference will no longer be changed by this module.Unsetmanual codeand the reference code will be unlocked again.Known issues / RoadmapIn case of attribute name update, related mask are not updated.Bug TrackerBugs are tracked onGitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomedfeedback.Do not contact contributors directly about support or help with technical issues.CreditsAuthorsAvancOSCShine ITTecnativaAkretionContributorsAlfredo de la Fuente <alfredodelafuente@avanzosc.es>Tony Gu <tony@openerp.cn>David Beal <david.beal@akretion.com>Daniel Campos <danielcampos@avanzosc.es>Kévin Roche <kevin.roche@akretion.com>Tecnativa <tecnativa.com>:
* David Vidal
* Pedro M. Baeza
* João MarquesMaintainersThis module is maintained by the OCA.OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.Currentmaintainer:This module is part of theOCA/product-variantproject on GitHub.You are welcome to contribute. To learn how please visithttps://odoo-community.org/page/Contribute.