Skip to main content

Product Variant Default Code

Project description

License: AGPL-3

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: 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

Configuration

To set the reference mask up on any product template ‘Variant reference mask’ new field.

When creating a new product template without specifying the Variant reference mask, a default value for Variant reference mask will 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 corresponding Attribute Code (of the attribute value) inserted. Besides the default value, Variant reference mask can be configured to your liking, make sure putting the Attribute Name inside [] marks (it is case sensitive).

Example:

Creating a product named Jacket with two attributes, Size and Color:

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 be Bl-L, Wh-L, Bl-XL and Wh-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 like Jacket/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 product default_code. In the first example, setting a Color code to CO would give default_code like this: COBl-L, COWh-L, COBl-XL and COWh-XL.

Avoiding mask in variants

You can avoid this behavior or force a manual default_code on variant. To do so, go to Product Variants > [any variant you want to set up] and set manually its reference code. The field manual code will be set to on and the variant internal reference will no longer be changed by this module.

Unset manual code and the reference code will be unlocked again.

Try me on Runbot

Known issues / Roadmap

In case of attribute name update, related mask are not updated.

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smash it by providing detailed and welcomed feedback.

Credits

Images

  • Odoo Community Association: Icon.

Contributors

Maintainer

Odoo Community Association

This 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.

To contribute to this module, please visit https://odoo-community.org.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file odoo11_addon_product_variant_default_code-11.0.1.0.0.99.dev5-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for odoo11_addon_product_variant_default_code-11.0.1.0.0.99.dev5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 61a1db12cbe2ace1ead73df545873e207cf8f34c92933240a2ca865706feeed8
MD5 26ef9f1de3b50bb12ca753814616a539
BLAKE2b-256 98388c0750e2fed293394319ed806a68ffc7cba07cd30e5d797f5ce590f6d3aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page