Metadata-Version: 2.1
Name: odoo-addon-product_import_autocomplete_attribute
Version: 18.0.1.0.0.4
Requires-Python: >=3.10
Requires-Dist: odoo==18.0.*
Summary: Sync product variant attributes to template
Home-page: https://github.com/OCA/product-attribute
License: AGPL-3
Author: Akretion, Odoo Community Association (OCA)
Author-email: support@odoo-community.org
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 18.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Description-Content-Type: text/x-rst

.. image:: https://odoo-community.org/readme-banner-image
   :target: https://odoo-community.org/get-involved?utm_source=readme
   :alt: Odoo Community Association

=====================================
Product Import Autocomplete Attribute
=====================================

.. 
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! This file is generated by oca-gen-addon-readme !!
   !! changes will be overwritten.                   !!
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! source digest: sha256:646b39004116e52d956de3884fd1c61f19c262625062f978ca12135b40747ecb
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
    :target: https://odoo-community.org/page/development-status
    :alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
    :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
    :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github
    :target: https://github.com/OCA/product-attribute/tree/18.0/product_import_autocomplete_attribute
    :alt: OCA/product-attribute
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/product-attribute-18-0/product-attribute-18-0-product_import_autocomplete_attribute
    :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
    :target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=18.0
    :alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module updates the attribute lines of product templates when
importing product variants.

Natively, product template attribute values are synced from the template
to its variants, but the reverse is not true:

- the base method ``product_template.create_variant_ids()`` uses the
  template attributes to create the variants (template -> variant)
- this module uses the attributes of the imported variants to update the
  attribute values of the linked template (variant -> template)

**Table of contents**

.. contents::
   :local:

Configuration
=============

Install this module and the purchase or sale module to get product
menus.

Prepare CSV files to import variants with attribute values which are not
available on their related product template.

Usage
=====

In order to better test and illustrate this module, example CSV files
are provided in the ``example`` folder to import some variants (you will
need the demo data).

The demo data provides 2 attributes, each with 3 possible values:

- Cut: Short sleeves, Long sleeves, Tanktop
- Embroidery: Cheap, High quality, Average

At the beginning, the product template "T-shirt" declares only one
attribute with two values:

.. code:: text

   Cut: Short sleeves, Long sleeves

|image1|

Its variants are:

1. Cut: Short sleeves
2. Cut: Long sleeves

**First import**

Go to the product variants page and import the first CSV file of the
``example`` folder. It creates a new "T-shirt" variant:
``Cut: Tanktop, Embroidery: Cheap``.

The template "T-shirt" now declares a new attribute and two new values:

.. code:: text

   Cut: Short sleeves, Long sleeves, Tanktop
   Embroidery: Cheap

|image2|

   **Note**: the new "Embroidery" attribute has a single value, so Odoo
   automatically adds "Embroidery: Cheap" to all the existing variants
   (the two original ones included). Indeed, a variant always carries
   one value per attribute line of its template.

The variants are now:

1. Cut: Short sleeves, Embroidery: Cheap
2. Cut: Long sleeves, Embroidery: Cheap
3. Cut: Tanktop, Embroidery: Cheap

**Second import**

Go to the product variants page and import the second CSV file of the
``example`` folder. It creates 2 new "T-shirt" variants:
``Cut: Short sleeves, Embroidery: Average``, and
``Cut: Long sleeves, Embroidery: High quality``.

The template "T-shirt" now declares 2 attributes, each with 3 possible
values:

.. code:: text

   Cut: Short sleeves, Long sleeves, Tanktop
   Embroidery: Cheap, High quality, Average

|image3|

The resulting variants of the template are then:

1. Cut: Short sleeves, Embroidery: Cheap
2. Cut: Long sleeves, Embroidery: Cheap
3. Cut: Tanktop, Embroidery: Cheap
4. Cut: Short sleeves, Embroidery: Average
5. Cut: Long sleeves, Embroidery: High quality

|image4|

   **Note**: even if both attributes are configured with
   ``Variant Creation: Instantly``, importing variants only creates the
   imported combinations. For example, no
   ``Cut: Tanktop, Embroidery: Average`` variant is created.

.. |image1| image:: https://raw.githubusercontent.com/OCA/product-attribute/18.0/product_import_autocomplete_attribute/static/description/step_1.png
.. |image2| image:: https://raw.githubusercontent.com/OCA/product-attribute/18.0/product_import_autocomplete_attribute/static/description/step_2_tmpl.png
.. |image3| image:: https://raw.githubusercontent.com/OCA/product-attribute/18.0/product_import_autocomplete_attribute/static/description/step_3_tmpl.png
.. |image4| image:: https://raw.githubusercontent.com/OCA/product-attribute/18.0/product_import_autocomplete_attribute/static/description/step_3_variant.png

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_import_autocomplete_attribute%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* Akretion

Contributors
------------

- Akretion:

  - Kevin Khao
  - Sébastien Beau <sebastien.beau@akretion.com>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
   :alt: Odoo Community Association
   :target: https://odoo-community.org

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.

.. |maintainer-bealdav| image:: https://github.com/bealdav.png?size=40px
    :target: https://github.com/bealdav
    :alt: bealdav

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-bealdav| 

This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/18.0/product_import_autocomplete_attribute>`_ project on GitHub.

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