Skip to main content

Product Variant Default Code

Beta License: AGPL-3 OCA/product-variant Translate me on Weblate Try me on Runbot

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(C): White(Wh), Black(Bl) - Size(S): M(M), L(L)

  • Reference mask: JKT01-[Color]-[Size]

  • Reference on variants:

    • JKT01-CWh-SM Jacket White M

    • JKT01-CBl-SM Jacket Black M

    • JKT01-CWh-SL Jacket White L

    • JKT01-CBl-SL Jacket Black L

Table of contents

Usage

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

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 smashing it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • AvancOSC

  • Shine IT

  • Tecnativa

Contributors

Maintainers

This module is maintained by the OCA.

Odoo Community Association

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.

This module is part of the OCA/product-variant project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Metadata

Release files for odoo13-addon-product-variant-default-code 13.0.1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for odoo13-addon-product-variant-default-code 13.0.1.1.0
File Interpreter ABI Platform Actions
odoo13_addon_product_variant_default_code-13.0.1.1.0-py3-none-any.whl Python 3 none any Details for odoo13_addon_product_variant_default_code-13.0.1.1.0-py3-none-any.whl

Release files / odoo13_addon_product_variant_default_code-13.0.1.1.0-py3-none-any.whl

Download URL odoo13_addon_product_variant_default_code-13.0.1.1.0-py3-none-any.whl
Size 73.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a5389cc09d6582945208d0a6fbb68b68ce2a48c46f5d39053fdd5f7ac290d915
BLAKE2b-256 checksum
How to use checksums
1f86caf13f4d86456ca57f5409964efb6d1d0b4d8e0b26f1cf761b6e80e75581
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.5

Security for odoo13-addon-product-variant-default-code 13.0.1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page