Search 1.9 billion lines of Odoo code on GitHub

product_variant_default_code

Author: AvancOSC, Shine IT, Tecnativa, Akretion, Odoo Community Association (OCA)
License: AGPL-3
Branch: 14.0-fix-variant-unlink
Repository: akretion/product-variant
Dependencies: base_setup, and product
Languages: HTML (412, 13.1%), PO File (1829, 58.3%), Python (587, 18.7%), XML (153, 4.9%), and reStructuredText (156, 5.0%)
Other branches: 10.0-mig-product_variant_default_code, 11-fix_variant_default_code_multicompany, 12.0-product-attribute-group, 12.0-product_variant_default_code-fix-onchange, 14.0, 14.0-add-product_variant_default_code_constraint, 14.0-fix-check_code_of_active_value_ids, 14.0-fix-product_variant_default_code, 14.0-imp-product_variant_inactive, 14.0-imp-tmpl_default_code_as_default_prefix_code, 14.0-mig-product_variant_inactive, 14.0-mig-product_variant_sale_price, 14.0-pr-263-265-266, 14.0-product-attribute-group, 14.0-product-variant-inactive, 14.0-product_variant_default_code, 14.0-product_variant_inactive-desactivate-all-variants, and 14.0-product_variant_inactive-remove-button-activate
Other repositories: 394879024/odoomrp-wip, AgoraDev/odoomrp-wip, Alfa-90/product-variant, Antiun/odoomrp-wip, Callino/product-variant, Change2improve/product-variant, ClearCorp/odoomrp-wip, Comunitea/product-variant, Daniel-CA/product-variant, DarkGreising/odoomrp-wip, Dayssam/odoomrp-wip, Diego88cc/odoomrp-wip, Digital5-Odoo/odoomrp-wip, Dobtor-OCA/product-variant, ERPLibre/product-variant, ElvenStudio/odoomrp-wip, Endika/odoomrp-wip, FelixAdler/odoomrp-wip, ForgeFlow/odoomrp-wip, ForgeFlow/product-variant, GGamblin/odoomrp-wip, Gabinete-Digital/product-variant, GiacoJona/product-variant, Gofekra/product-variant, GrupoAlvamex/odoomrp-wip, GrupoAlvamex/product-variant, Guobower/product-variant, HaojunZou/odoomrp-wip, IJOL/odoomrp-wip, InakiZabala/odoomrp-wip, InfotoolsCorp/odoomrp-wip, Ingeos/odoomrp-wip, Ingeos/product-variant, Innovahn/odoomrp-wip, JavierMarhuenda/odoomrp-wip, JuaniFreedoo/odoomrp-wip, KennyLeung/odoomrp-wip, LudLaf/odoomrp-wip, MadsackMediaStore/odoomrp-wip, Martronic-SA/product-variant, MathBenTech/product-variant, MedMehdiMMM/odoomrp-wip, MindAndGo/odoomrp-wip, MrZ-777/odoomrp-wip, NeatNerdPrime/product-variant, OCA-MUK/product-variant, OCA/product-variant, OdooBulgaria/odoomrp-wip, OpenPymeMx/odoomrp-wip, OpusVL/product-variant, PESOL/product-variant, PlanetaTIC/product-variant, QANSEE/odoomrp-wip, SalahAdDin/product-variant, SanteLibre/product-variant, Sarfarazsajjad/odoomrp-wip, SetRac/odoomrp-wip, SeuMarco/odoomrp-wip, SeuMarco/product-variant, SimoRubi/product-variant, SimoneVagile/product-variant, Sjd-Risca/odoomrp-wip, StefanRijnhart/odoomrp-wip, Studio73/product-variant, TRESCLOUD/product-variant, Tecnativa/product-variant, Trust-Code/odoomrp-wip, Vauxoo/odoomrp-wip, Vauxoo/product-variant, VbossEkat/odoomrp-wip, VisiionSoluciones/odoomrp-wip, VisiionSolucionesTecnologicas/product-variant, Yakulu/product-variant, YogendrasinhChavda/odoomrp-wip, aaltinisik/odoomrp-wip, aaltinisik/product-variant, abdo3247/odoomrp-wip, acsone/product-variant, aduijs/odoomrp-wip, agaldona/odoomrp-wip-1, akretion/odoomrp-wip, alangwansui/odoomrp-wip, alexteodor/odoomrp-wip, alfredoavanzosc/odoomrp-wip-1, alhashash/odoomrp-wip, alonesword/odoomrp-wip, alpseber/odoomrp-wip, amarildogolloshi/odoomrp-wip, andhit-r/odoomrp-wip, anndream/odoomrp-wip, annieclone/odoomrp-wip, anodino-dev/odoomrp-wip, apetbiz/product-variant, arasty/odoomrp-wip, archetipo/odoomrp-wip, arnaulorente/odoomrp-wip, asphaltzipper/odoomrp-wip, augustodinizl/product-variant, aurestic/odoomrp-wip, aurestic/product-variant, bealdav/product-variant, binovo/odoomrp-wip, bishalgit/product-variant, bisnesmart/odoomrp-wip, bitodoo/product-variant, brain-tec/product-variant, bunhin/odoomrp-wip, camptocamp/product-variant, carlosap92/odoomrp-wip, ccdos/odoomrp-wip, ceteca/odoomrp-wip, chajmill/odoomrp-wip, chenjingxiong/odoomrp-wip, chenrobotcat/odoomrp-wip, chenyingkun/odoomrp-wip, cialuo/odoomrp-wip, codequarters/odoomrp-wip, codewr/odoomrp-wip, colima/odoomrp-wip, colmeirin/odoomrp-wip, contactek/odoomrp-wip, coopiteasy/product-variant, copermine/odoomrp-wip, cshardey/odoomrp-wip, cubells/odoomrp-wip, cubells/product-variant, cvinh/odoomrp-wip, damdam-s/odoomrp-wip, damendieta/odoomrp-wip, danielkurman/odoomrp-wip, danztensai/odoomrp-wip, daramousk/odoomrp-wip, ddico/odoomrp-wip, dhp-denero/odoomrp-wip, diagramsoftware/odoomrp-wip, diggy128/odoomrp-wip, diggy128/product-variant, digitalwow/odoomrp-wip, diogocduarte/odoomrp-wip, disna-sistemas/odoomrp-wip, dong-z/product-variant, drl9319/odoomrp-wip, druidoo-dev/product-variant, duanyp1991/odoomrp-wip, dvitme/odoomrp-wip, eLBati/product-variant, eezee-it/odoomrp-wip, emendez2006/odoomrp-wip, enmingc/odoomrp-wip, ernestotejeda/product-variant, erocre/odoomrp-wip, esthermm/odoomrp-wip, ethernetcash/odoomrp-wip, exosoftware/oca-product-variant, factorlibre/odoomrp-wip, factorlibre/product-variant, farfansixto/odoomrp-wip, fedexin40/odoomrp-wip, fevxie/odoomrp-wip, forvas/odoomrp-wip, frankchongli/odoomrp-wip, garzadekoster/odoomrp-wip, george-taotaome/odoomrp-wip, gkliska/odoomrp-wip, gleke/odoomrp-wip, globalyst/odoomrp-wip, gmoncada/odoomrp-wip, grindtildeath/product-variant, grottas/odoomrp-wip, gsunjka/odoomrp-wip, gurneyalex/product-variant, haryoran04/odoomrp-wip, hassanfadl/odoomrp-wip, hifans/odoomrp-wip, hifly/odoomrp-wip, hinfo506/product-variant, hotkee/odoomrp-wip, iamyeonhan/odoomrp-wip, iaranburu/odoomrp-wip, idealisconsultingbe/product-variant, igallart/odoomrp-wip, igallart/product-variant, igorabpereira/odoomrp-wip, initOS/odoomrp-wip, itmeca/odoomrp-wip, izzihector/product-variant, jackethu/odoomrp-wip, jamotion/product-variant, jason156/odoomrp-wip, javieralmancevo/odoomrp-wip, jcarlosmontoya/odoomrp-wip, jellyhappy/odoomrp-wip, jhoengels/odoomrp-wip, jlaloux/product-variant, johannbelet/odoomrp-wip, jorsea/odoomrp-wip, jparssi/odoomrp-wip, juanfe/odoomrp-wip, jusdng/odoomrp-wip, kholioeg/odoomrp-wip, kkarolis/odoomrp-wip, kkoci/odoomrp-wip, kmee/product-variant, konsoar/odoomrp-wip, kos94ok-3D/product-variant, kossovo/odoomrp-wip, lbelorgey/odoomrp-wip, leangjia/odoomrp-wip, lepistone/odoomrp-wip, levkar/odoomrp-wip, lideritjnma/product-variant, lihaihe/odoomrp-wip, likaiyuan/odoomrp-wip, ljsalvatierra-binovo/odoomrp-wip, maljac/odoomrp-wip, marcel1981/odoomrp-wip, marcelomora/odoomrp-wip, marionumza/odoomrp-wip, mathi123/odoomrp-wip, mauroanelli2017/odoomrp-wip, maxhome1/odoomrp-wip, mayang1178/odoomrp-wip, michaeljohn32/odoomrp-wip, mikelarre/odoomrp-wip-1, mikelarre/product-variant, mohshedid/odoomrp-wip, mohzein/odoomrp-wip, molandtoxx/odoomrp-wip, morgana68/odoomrp-wip, msteinfeld-intero/odoomrp-wip, muguli22/odoomrp-wip, mutita/odoomrp-wip, myodoo/odoomrp-wip, niulinlnc/odoomrp-wip, numerigraphe/odoomrp-wip, odoo-modules/odoomrp-wip, odoobgorg/odoomrp-wip, odoocn/odoomrp-wip, odoomrp/odoomrp-wip, oihane/odoomrp-wip, one2pret/odoomrp-wip, onurugur/odoomrp-wip, onurugur/product-variant, open-synergy/odoomrp-wip, oscars8a/product-variant, osstw/odoomrp-wip, ozono/odoomrp-wip, p-tombez/product-variant, parchanco/odoomrp-wip, pedrobaeza/odoomrp-wip, petypi/odoomrp-wip, presenceverte/product-variant, prisehub/odoomrp-wip, pscloud/product-variant, pythoner-3k/odoomrp-wip, qtheuret/product-variant, r3ap3r2004/odoomrp-wip, raycarnes/odoomrp-wip, rchavik/product-variant, rdeheele/odoomrp-wip, richard-willdooit/odoomrp-wip, rlizana/odoomrp-wip, rosenvladimirov/product-variant, rossasa/odoomrp-wip, rsullivan2704/product-variant, s2d4theworld/odoomrp-wip, sagar-developer-92/odoomrp-wip, saigonsofttech/odoomrp-wip, samsagaz/product-variant, samuel1971/odoomrp-wip, sanube/product-variant, sasakuma/odoomrp-wip, sergiocorato/odoomrp-wip, sergiocorato/product-variant, shine-it/odoomrp-wip, simoneversienti/product-variant, slevenhagen/odoomrp-wip, spoerp/product-variant, subteno-it/odoomrp-wip, sum1201/product-variant, supuy-ruby/odoomrp-wip, syci/odoomrp-wip, tegin/product-variant, thaiodoo/odoomrp-wip, thinkopensolutions/odoomrp-odoomrp-wip, time-table/odoomrp-wip, topecz/odoomrp-wip, treytux/odoomrp-wip, tvtma/odoomrp-wip, ubic135/odoomrp-wip, vafonso/odoomrp-wip, valenciaricardos/odoomrp-wip, valley51/odoomrp-wip, valmarnet/product-variant, versada/odoomrp-wip, vrms/odoomrp-wip, vsanjuan2/odoomrp-wip, wahhid/odoomrp-wip, wanfgh/odoomrp-wip, waynejid/odoomrp-wip, westlyou/odoomrp-wip, willmakenoise/product-variant, windedge/odoomrp-wip, x0rzkov/odoo-product-variant, xiaowenzi/odoomrp-wip, xpansa/odoomrp-wip, yahooboohooyah/odoomrp-wip, yasmanycastillo/odoomrp-wip, yastri/odoomrp-wip, yoozeer/odoomrp-wip, yustas147/odoomrp-wip, zbik2607/odoomrp-wip, zeroheure/product-variant, zhaohuaw/odoomrp-wip, zhuyangbin/product-variant, and zmakrelouf/odoomrp-wip

<h1 class="title">Product Variant Default Code</h1> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/product-variant/tree/14.0/product_variant_default_code"><img alt="OCA/product-variant" src="https://img.shields.io/badge/github-OCA%2Fproduct--variant-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/product-variant-14-0/product-variant-14-0-product_variant_default_code"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/137/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p>This module automatically generate Product Reference (default_code) according to attributes data with a configurable behavior.</p> <p>It defines a reference mask on the product templates so the variants references are automatically set. For example:</p> <ul class="simple"> <li>Product template: Jacket</li> <li>Attributes: - Color: White, Black - Size: M, L</li> <li>Reference mask: <cite>JKT01-[Color]-[Size]</cite></li> <li>Reference on variants:<ul> <li><cite>JKT01-Wh-M</cite> Jacket White M</li> <li><cite>JKT01-Bl-M</cite> Jacket Black M</li> <li><cite>JKT01-Wh-L</cite> Jacket White L</li> <li><cite>JKT01-Bl-L</cite> Jacket Black L</li> </ul> </li> </ul> <p><strong>Table of contents</strong></p> <div class="contents local topic" id="contents"> <ul class="simple"> <li><a class="reference internal" href="#usage" id="id1">Usage</a><ul> <li><a class="reference internal" href="#avoiding-mask-in-variants" id="id2">Avoiding mask in variants</a></li> </ul> </li> <li><a class="reference internal" href="#known-issues-roadmap" id="id3">Known issues / Roadmap</a></li> <li><a class="reference internal" href="#bug-tracker" id="id4">Bug Tracker</a></li> <li><a class="reference internal" href="#credits" id="id5">Credits</a><ul> <li><a class="reference internal" href="#authors" id="id6">Authors</a></li> <li><a class="reference internal" href="#contributors" id="id7">Contributors</a></li> <li><a class="reference internal" href="#maintainers" id="id8">Maintainers</a></li> </ul> </li> </ul> </div> <a name="usage"></a> <h2><a class="toc-backref" href="#id1">Usage</a></h2> <p>To set the reference mask up on any product template 'Variant reference mask' new field.</p> <p>When creating a new product template without specifying the <em>Variant reference mask</em>, a default value for <em>Variant reference mask</em> 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 <em>Attribute Code</em> (of the attribute value) inserted. Besides the default value, <em>Variant reference mask</em> can be configured to your liking, make sure putting the <em>Attribute Name</em> inside <cite>[]</cite> marks (it is case sensitive).</p> <p>Example:</p> <p>Creating a product named <em>Jacket</em> with two attributes, <em>Size</em> and <em>Color</em>:</p> <pre> <code>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)</code> </pre> <p>The automatically generated default value for the Variant reference mask will be <cite>[Color]-[Size]</cite> and so the 'default code' on the variants will be <cite>Bl-L</cite>, <cite>Wh-L</cite>, <cite>Bl-XL</cite> and <cite>Wh-XL</cite>.</p> <p>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, <cite>Jacket/[Size]~[Color]~[Size]</cite>, and the generated code on variants will be something like <cite>Jacket/L~Bl~L</cite> (for variant with Color &quot;Black&quot; and Size &quot;L&quot;).</p> <p>When the code attribute is changed, it automatically regenerates the 'default code' on all variants affected.</p> <p>Aditionally, a product attribute can be set and so it will be appended to the product <cite>default_code</cite>. In the first example, setting a <cite>Color</cite> code to <cite>CO</cite> would give <cite>default_code</cite> like this: <cite>COBl-L</cite>, <cite>COWh-L</cite>, <cite>COBl-XL</cite> and <cite>COWh-XL</cite>.</p> <a name="avoiding-mask-in-variants"></a> <h3><a class="toc-backref" href="#id2">Avoiding mask in variants</a></h3> <p>You can avoid this behavior or force a manual default_code on variant. To do so, go to <em>Product Variants &gt; [any variant you want to set up]</em> and set manually its reference code. The field <cite>manual code</cite> will be set to on and the variant internal reference will no longer be changed by this module.</p> <p>Unset <cite>manual code</cite> and the reference code will be unlocked again.</p> <a name="known-issues-roadmap"></a> <h2><a class="toc-backref" href="#id3">Known issues / Roadmap</a></h2> <ul class="simple"> <li>In case of attribute name update, related mask are not updated.</li> </ul> <a name="bug-tracker"></a> <h2><a class="toc-backref" href="#id4">Bug Tracker</a></h2> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/product-variant/issues">GitHub Issues</a>. 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 <a class="reference external" href="https://github.com/OCA/product-variant/issues/new?body=module:%20product_variant_default_code%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <p>Do not contact contributors directly about support or help with technical issues.</p> <a name="credits"></a> <h2><a class="toc-backref" href="#id5">Credits</a></h2> <a name="authors"></a> <h3><a class="toc-backref" href="#id6">Authors</a></h3> <ul class="simple"> <li>AvancOSC</li> <li>Shine IT</li> <li>Tecnativa</li> <li>Akretion</li> </ul> <a name="contributors"></a> <h3><a class="toc-backref" href="#id7">Contributors</a></h3> <ul class="simple"> <li>Alfredo de la Fuente &lt;<a class="reference external" href="mailto:alfredodelafuente&#64;avanzosc.es">alfredodelafuente&#64;avanzosc.es</a>&gt;</li> <li>Tony Gu &lt;<a class="reference external" href="mailto:tony&#64;openerp.cn">tony&#64;openerp.cn</a>&gt;</li> <li>David Beal &lt;<a class="reference external" href="mailto:david.beal&#64;akretion.com">david.beal&#64;akretion.com</a>&gt;</li> <li>Daniel Campos &lt;<a class="reference external" href="mailto:danielcampos&#64;avanzosc.es">danielcampos&#64;avanzosc.es</a>&gt;</li> <li>Kévin Roche &lt;<a class="reference external" href="mailto:kevin.roche&#64;akretion.com">kevin.roche&#64;akretion.com</a>&gt;</li> <li>Tecnativa &lt;tecnativa.com&gt;: * David Vidal * Pedro M. Baeza * João Marques</li> </ul> <a name="maintainers"></a> <h3><a class="toc-backref" href="#id8">Maintainers</a></h3> <p>This module is maintained by the OCA.</p> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <p>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.</p> <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p> <p><a class="reference external" href="https://github.com/Kev-Roche"><img alt="Kev-Roche" src="https://github.com/Kev-Roche.png?size=40px" /></a></p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/product-variant/tree/14.0/product_variant_default_code">OCA/product-variant</a> project on GitHub.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>