<h1 class="title">Product import autocomplete attribute</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-attribute/tree/12.0/product_import_autocomplete_attribute"><img alt="OCA/product-attribute" src="https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/product-attribute-12-0/product-attribute-12-0-product_import_autocomplete_attribute"><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/135/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>Although product template attribute choices are synced from template to product variant, the reverse is not true.</p>
<p>In other words,</p>
<ul class="simple">
<li>Base function product_template.create_variant_ids() uses product template's product.attribute to create variants (tmpl->variant)</li>
<li>Inversely, this module uses the product.attribute on variants, to update product.attribute on the product template (variant->tmpl)</li>
</ul>
<p>This product.attribute sync is triggered when you do an import of product variants.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#configuration" id="id1">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="id2">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<a name="configuration"></a>
<h2><a class="toc-backref" href="#id1">Configuration</a></h2>
<p>Create some product attributes</p>
<a name="usage"></a>
<h2><a class="toc-backref" href="#id2">Usage</a></h2>
<p>In order to better test and illustrate this module, and example CSV file is provided in the example folder (you will need the demo data).</p>
<p>First, the setup:</p>
<ul class="simple">
<li>We have a product attribute named "Cut" which has 3 possible values: "Short sleeved", "Long sleeved", "Tanktop"</li>
<li>We have a product attribute named "Embroidery" which has 3 possible values: "Cheap", "High quality", "Average"</li>
</ul>
<p>Next, for our example:</p>
<ul>
<li><p class="first">Install this module and the purchase or sale module so that you have product menus</p>
</li>
<li><p class="first">Observe on product template "T-shirt" the attribute lines and possible values. We have:</p>
<blockquote>
<p>Cut: Short-sleeved, Long-sleeved</p>
</blockquote>
</li>
</ul>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/product-attribute/12.0/product_import_autocomplete_attribute/static/description/step_1.png" src="https://raw.githubusercontent.com/OCA/product-attribute/12.0/product_import_autocomplete_attribute/static/description/step_1.png" style="width: 600px;" />
</div>
<ul>
<li><p class="first">Go to product variants page, import the provided CSV file in the "examples" folder</p>
<dl class="docutils">
<dt>This will create a new T-shirt variant with the attributes:</dt>
<dd><p class="first last">Cut: Tanktop; Embroidery: Cheap</p>
</dd>
</dl>
</li>
</ul>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/product-attribute/12.0/product_import_autocomplete_attribute/static/description/step_2_variant.png" src="https://raw.githubusercontent.com/OCA/product-attribute/12.0/product_import_autocomplete_attribute/static/description/step_2_variant.png" style="width: 600px;" />
</div>
<ul>
<li><p class="first">Observe on product template "T-shirt" the attribute lines and possible values.
Because imported the variant with new attributes, we now have:</p>
<p>Cut: Short-sleeved, Long-sleeved, Tanktop</p>
<p>Embroidery: Cheap</p>
</li>
</ul>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/product-attribute/12.0/product_import_autocomplete_attribute/static/description/step_2_tmpl.png" src="https://raw.githubusercontent.com/OCA/product-attribute/12.0/product_import_autocomplete_attribute/static/description/step_2_tmpl.png" style="width: 600px;" />
</div>
<p>Thus we have synced product variant attributes -> product template attributes.</p>
<p>Let's continue:</p>
<ul>
<li><p class="first">Go to product variants page, import the 2nd provided CSV file in the "examples" folder</p>
<p>This will create 2 new T-shirt variants as follows:</p>
<blockquote>
<p>Cut: Short-sleeved; Embroidery: Average</p>
<p>Cut: Long-sleeved; Embroidery: High quality</p>
</blockquote>
</li>
</ul>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/product-attribute/12.0/product_import_autocomplete_attribute/static/description/step_3_variant.png" src="https://raw.githubusercontent.com/OCA/product-attribute/12.0/product_import_autocomplete_attribute/static/description/step_3_variant.png" style="width: 600px;" />
</div>
<ul>
<li><p class="first">Observe on product template "T-shirt" the attribute lines and possible values.
Because we imported the new attributes, we now have:</p>
<blockquote>
<p>Cut: Short-sleeved, Long-sleeved, Tanktop</p>
<p>Embroidery: Cheap, Average, High Quality</p>
</blockquote>
</li>
</ul>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/product-attribute/12.0/product_import_autocomplete_attribute/static/description/step_3_tmpl.png" src="https://raw.githubusercontent.com/OCA/product-attribute/12.0/product_import_autocomplete_attribute/static/description/step_3_tmpl.png" style="width: 600px;" />
</div>
<ul class="simple">
<li>Because this module prevents creating all the possible variants to prevent exponential growth of variants, we only have the following variants that we imported according to the following matrix:</li>
</ul>
<div class="line-block">
<div class="line">(Attribute combination) | Cheap | High quality | Average |</div>
<div class="line">----------------------- | ----- | ------------ | ------- |</div>
<div class="line">Short sleeve | No | No | Yes |</div>
<div class="line">Long sleeve | No | Yes | No |</div>
<div class="line">Tanktop | Yes | No | No |</div>
</div>
<a name="bug-tracker"></a>
<h2><a class="toc-backref" href="#id3">Bug Tracker</a></h2>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/product-attribute/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-attribute/issues/new?body=module:%20product_import_autocomplete_attribute%0Aversion:%2012.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="#id4">Credits</a></h2>
<a name="authors"></a>
<h3><a class="toc-backref" href="#id5">Authors</a></h3>
<ul class="simple">
<li>Akretion</li>
</ul>
<a name="contributors"></a>
<h3><a class="toc-backref" href="#id6">Contributors</a></h3>
<ul class="simple">
<li>Kevin Khao <<a class="reference external" href="mailto:kevin.khao@akretion.com">kevin.khao@akretion.com</a>></li>
<li>Sébastien Beau <<a class="reference external" href="mailto:sebastien.beau@akretion.com">sebastien.beau@akretion.com</a>></li>
</ul>
<a name="maintainers"></a>
<h3><a class="toc-backref" href="#id7">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>This module is part of the <a class="reference external" href="https://github.com/OCA/product-attribute/tree/12.0/product_import_autocomplete_attribute">OCA/product-attribute</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>