Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] product_variant_default_code #341

Open
wants to merge 73 commits into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
eff5d7c
[NEW product_variant_default_code]
Oct 21, 2014
01c935c
[FIX] product_variant_default_code: Fixed some problems and enhance code
pedrobaeza Nov 18, 2014
e20ddd7
[IMP product_variant_default_code]
Nov 20, 2014
48edd9c
setup a mask to control the output of variant default code
digitalsatori Dec 29, 2014
01cfe1c
[FIX product_variant_default_code]
Jan 16, 2015
a21eeb5
[FIX] product_variant_default_code: Fix error when no reference mask …
pedrobaeza Feb 22, 2015
3a6a6f0
Slovene translations of odoomrp modules
sysadminmatmoz Aug 15, 2015
294060a
[REF] product_variant_default_code: Modular programming on method ren…
Dec 23, 2015
d46f8ab
[MIG] product_variant_default_code: Migration to 10.0
chienandalu Jul 25, 2017
c1d4099
[IMP] Attribute code integration
chienandalu Sep 14, 2017
7fbe38b
[IMP] Merge product_code_builder functionalities
chienandalu Sep 20, 2017
9965817
[IMP] dependency, field name, complete view
bealdav Oct 11, 2017
6bb39e4
[MIG] product_variant_default_code
Feb 21, 2018
13f9b7d
[IMP+FIX] product_variant_default_code: Several things:
Jun 7, 2018
185dd1f
[FIX] product_variant_default_code: Read parameters with sudo()
pedrobaeza Nov 7, 2018
97303d8
[MIG] product_variant_default_code: Migration to 12.0
mikelarre Sep 24, 2019
cdb10d2
Translated using Weblate (Croatian)
badbole Dec 4, 2019
bd5f136
[FIX] product_variant_default_code: fix product.template write to acc…
Feb 20, 2020
654e0a2
Added translation using Weblate (Portuguese)
pedrocs-exo Jun 2, 2020
9709a2a
Translated using Weblate (Portuguese)
pedrocs-exo Jun 2, 2020
4d1dbd5
[IMP] product_variant_default_code: black, isort, prettier
joao-p-marques Nov 2, 2020
66b4ebf
[MIG] product_variant_default_code: Migration to 13.0
joao-p-marques Nov 3, 2020
c36c1a7
[UPD] Update product_variant_default_code.pot
oca-travis Nov 9, 2020
42ee7f4
[IMP] product_variant_default_code: black, isort, prettier
joao-p-marques Nov 10, 2020
e74d580
[MIG] product_variant_default_code: Migration to 14.0
joao-p-marques Nov 10, 2020
0fe84ad
[UPD] Update product_variant_default_code.pot
oca-travis Nov 11, 2020
5dbe0c9
[UPD] README.rst
OCA-git-bot Nov 11, 2020
e6b214c
[14.0] [FIX] enable edit of attribute code in form view
andreampiovesana Dec 12, 2020
7804ba5
[FIX] product_variant_default_code: Allow to edit attribute code
pedrobaeza Feb 5, 2021
1a4ab43
[FIX] product_variant_default_code: don't translate mask
chienandalu Feb 16, 2021
98983d2
product_variant_default_code 14.0.1.1.1
OCA-git-bot Feb 16, 2021
61a3a3c
[FIX] product_variant_default_code: fix onchange code value
chienandalu Feb 18, 2021
208bd0f
product_variant_default_code 14.0.1.1.2
OCA-git-bot Feb 19, 2021
19af9d3
[FIX] product_variant_default_code: FIx tests
joao-p-marques Feb 26, 2021
bb74c68
product_variant_default_code 14.0.1.1.3
OCA-git-bot Mar 7, 2021
52a9d7d
product_variant_default_code 14.0.1.1.4
OCA-git-bot Jul 29, 2021
bb494de
[14.0][IMP] product_variant_default_code: prefix_code as default_code…
Kev-Roche Sep 13, 2021
3898b68
[UPD] Update product_variant_default_code.pot
oca-travis Sep 18, 2021
d74e38d
product_variant_default_code 14.0.2.0.0
OCA-git-bot Sep 18, 2021
6193b5b
Update translation files
oca-transbot Sep 18, 2021
c0f9bbb
[IMP] update dotfiles [ci skip]
OCA-git-bot Mar 31, 2022
04e863a
[FIX]product_variant_default_code add tests
Kev-Roche Nov 17, 2021
bea10b2
[FIX] product_variant_default_code fixes
Kev-Roche Nov 17, 2021
1f0eb1c
[FIX] no update when both code_prefix and reference_mask changing
Kev-Roche Jan 26, 2022
617cf11
[UPD] Update product_variant_default_code.pot
oca-travis May 19, 2022
e2bbda3
[UPD] README.rst
OCA-git-bot May 19, 2022
6bf3c5f
product_variant_default_code 14.0.3.0.0
OCA-git-bot May 19, 2022
ee51010
Update translation files
oca-transbot May 19, 2022
521fa74
Translated using Weblate (Italian)
francesco-ooops May 31, 2022
8fe5d9d
Translated using Weblate (Italian)
SicurSam May 31, 2022
92a95d4
Translated using Weblate (Italian)
francesco-ooops May 31, 2022
7e06941
Translated using Weblate (Italian)
francesco-ooops May 31, 2022
7fd9c3e
[IMP][14.0] product tmpl default_code as default prefix_code
Kev-Roche Sep 7, 2022
405faa9
product_variant_default_code 14.0.3.0.1
OCA-git-bot Feb 9, 2023
b0f38d9
[FIX][product_variant_default_code] check code of active value_ids
Kev-Roche Oct 26, 2022
80db0b8
[16.0][MIG] product_variant_default_code: migration to 16.0
Rferri44-S73 Mar 13, 2023
2690b00
[UPD] Update product_variant_default_code.pot
May 2, 2023
b84b601
[UPD] README.rst
OCA-git-bot May 2, 2023
112f7b8
Update translation files
weblate May 2, 2023
9721ac1
Revert "[FIX][product_variant_default_code] check code of active valu…
pedrobaeza May 3, 2023
4ad8985
product_variant_default_code 16.0.1.0.1
OCA-git-bot May 3, 2023
07bf208
[FIX] product_variant_default_code: fix template error
pilarvargas-tecnativa May 6, 2023
0ec876f
product_variant_default_code 16.0.1.0.2
OCA-git-bot May 6, 2023
0204593
[FIX] product_variant_default_code: code_prefix in reference_mask
RabbitJon-S73 May 4, 2023
9d579d1
[UPD] README.rst
OCA-git-bot Sep 3, 2023
a1d2549
product_variant_default_code 16.0.1.0.3
OCA-git-bot Sep 7, 2023
618e8f0
[UPD] README.rst
OCA-git-bot Sep 7, 2023
2b97b96
Fix product_variant_default_code: Add api.model_create_multi
aliciagaarzo Dec 1, 2023
e4e7d90
[BOT] post-merge updates
OCA-git-bot Dec 12, 2023
aa821f8
[MIG] product_variant_default_code: pre-commit
astirpe Apr 8, 2024
3cce391
[MIG] product_variant_default_code: migrate to V17
astirpe Apr 8, 2024
2961af9
[FIX] product_variant_default_code: case of reference_mask is empty
astirpe Dec 6, 2024
71cc5c3
[FIX] product_variant_default_code ir.config_parameter
giarve Nov 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 176 additions & 0 deletions product_variant_default_code/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
============================
Product Variant Default Code
============================

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

.. |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/licence-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--variant-lightgray.png?logo=github
:target: https://github.com/OCA/product-variant/tree/17.0/product_variant_default_code
:alt: OCA/product-variant
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/product-variant-17-0/product-variant-17-0-product_variant_default_code
: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-variant&target_branch=17.0
:alt: Try me on Runboat

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

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

**Table of contents**

.. contents::
:local:

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

Known issues / Roadmap
======================

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

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-variant/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-variant/issues/new?body=module:%20product_variant_default_code%0Aversion:%2017.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
-------

* AvancOSC
* Shine IT
* Tecnativa
* Akretion

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

- Alfredo de la Fuente <alfredodelafuente@avanzosc.es>
- Tony Gu <tony@openerp.cn>
- David Beal <david.beal@akretion.com>
- Daniel Campos <danielcampos@avanzosc.es>
- Kévin Roche <kevin.roche@akretion.com>
- Tecnativa <tecnativa.com>:

- David Vidal
- Pedro M. Baeza
- João Marques

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-Kev-Roche| image:: https://github.com/Kev-Roche.png?size=40px
:target: https://github.com/Kev-Roche
:alt: Kev-Roche

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

|maintainer-Kev-Roche|

This module is part of the `OCA/product-variant <https://github.com/OCA/product-variant/tree/17.0/product_variant_default_code>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions product_variant_default_code/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
29 changes: 29 additions & 0 deletions product_variant_default_code/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2014 AvancOSC - Alfredo de la Fuente
# Copyright 2014 Tecnativa - Pedro M. Baeza
# Copyright 2014 Shine IT - Tony Gu
# Copyright 2017 Tecnativa - David Vidal
# Copyright 2017 Akretion - David Beal
# Copyright 2018 AvancOSC - Daniel Campos
# Copyright 2020 Tecnativa - João Marques
# Copyright 2021 Akretion - Kévin Roche
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Product Variant Default Code",
"version": "17.0.1.0.0",
"author": "AvancOSC, Shine IT, Tecnativa, Akretion, "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/product-variant",
"license": "AGPL-3",
"category": "Product",
"maintainers": ["Kev-Roche"],
"depends": ["product"],
"data": [
"security/product_security.xml",
"data/ir_config_parameter.xml",
"views/product_attribute_view.xml",
"views/product_view.xml",
"views/config_settings_view.xml",
],
"demo": ["demo/attribute_demo.xml"],
"installable": True,
}
11 changes: 11 additions & 0 deletions product_variant_default_code/data/ir_config_parameter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version='1.0' encoding='UTF-8' ?>
<odoo noupdate="1">
<record id="default_reference_separator" model="ir.config_parameter">
<field name="key">default_reference_separator</field>
<field name="value">-</field>
</record>
<record id="default_reference_missing_placeholder" model="ir.config_parameter">
<field name="key">default_reference_missing_placeholder</field>
<field name="value">/</field>
</record>
</odoo>
15 changes: 15 additions & 0 deletions product_variant_default_code/demo/attribute_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version='1.0' encoding='UTF-8' ?>
<odoo noupdate="1">
<record id="product.product_attribute_1" model="product.attribute">
<!-- Memory -->
<field name="code">M</field>
</record>
<record id="product.product_attribute_2" model="product.attribute">
<!-- Color -->
<field name="code">C</field>
</record>
<record id="product.product_attribute_3" model="product.attribute">
<!-- Wifi -->
<field name="code">W</field>
</record>
</odoo>
Loading
Loading