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: Migration to 17.0 #369

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
4c93dbb
[NEW product_variant_default_code]
Oct 21, 2014
6cf0457
[FIX] product_variant_default_code: Fixed some problems and enhance code
pedrobaeza Nov 18, 2014
47c3a26
[IMP product_variant_default_code]
Nov 20, 2014
646e203
setup a mask to control the output of variant default code
digitalsatori Dec 29, 2014
57b6d14
[FIX product_variant_default_code]
Jan 16, 2015
37f424c
[FIX] product_variant_default_code: Fix error when no reference mask …
pedrobaeza Feb 22, 2015
0bb07de
Slovene translations of odoomrp modules
sysadminmatmoz Aug 15, 2015
2c0141d
[REF] product_variant_default_code: Modular programming on method ren…
Dec 23, 2015
058176b
[MIG] product_variant_default_code: Migration to 10.0
chienandalu Jul 25, 2017
215166f
[IMP] Attribute code integration
chienandalu Sep 14, 2017
dc582b5
[IMP] Merge product_code_builder functionalities
chienandalu Sep 20, 2017
3ef6ded
[IMP] dependency, field name, complete view
bealdav Oct 11, 2017
f05cee8
[MIG] product_variant_default_code
Feb 21, 2018
45fcedb
[IMP+FIX] product_variant_default_code: Several things:
Jun 7, 2018
ea89d67
[FIX] product_variant_default_code: Read parameters with sudo()
pedrobaeza Nov 7, 2018
159aa88
[MIG] product_variant_default_code: Migration to 12.0
mikelarre Sep 24, 2019
fc6ab64
Translated using Weblate (Croatian)
badbole Dec 4, 2019
dce9ee4
[FIX] product_variant_default_code: fix product.template write to acc…
Feb 20, 2020
6742e03
Added translation using Weblate (Portuguese)
pedrocs-exo Jun 2, 2020
9b2299a
Translated using Weblate (Portuguese)
pedrocs-exo Jun 2, 2020
f3b0b95
[IMP] product_variant_default_code: black, isort, prettier
joao-p-marques Nov 2, 2020
7ac1f45
[MIG] product_variant_default_code: Migration to 13.0
joao-p-marques Nov 3, 2020
2ac95c2
[UPD] Update product_variant_default_code.pot
oca-travis Nov 9, 2020
7f086d5
[IMP] product_variant_default_code: black, isort, prettier
joao-p-marques Nov 10, 2020
5c7adf6
[MIG] product_variant_default_code: Migration to 14.0
joao-p-marques Nov 10, 2020
e9316e0
[UPD] Update product_variant_default_code.pot
oca-travis Nov 11, 2020
b4eb4aa
[UPD] README.rst
OCA-git-bot Nov 11, 2020
f301a79
[14.0] [FIX] enable edit of attribute code in form view
andreampiovesana Dec 12, 2020
aa10693
[FIX] product_variant_default_code: Allow to edit attribute code
pedrobaeza Feb 5, 2021
a6ded79
[FIX] product_variant_default_code: don't translate mask
chienandalu Feb 16, 2021
6a07f40
product_variant_default_code 14.0.1.1.1
OCA-git-bot Feb 16, 2021
06162cf
[FIX] product_variant_default_code: fix onchange code value
chienandalu Feb 18, 2021
d1953ae
product_variant_default_code 14.0.1.1.2
OCA-git-bot Feb 19, 2021
dca78a1
[FIX] product_variant_default_code: FIx tests
joao-p-marques Feb 26, 2021
ce6601d
product_variant_default_code 14.0.1.1.3
OCA-git-bot Mar 7, 2021
552d8fc
product_variant_default_code 14.0.1.1.4
OCA-git-bot Jul 29, 2021
54e2cbc
[14.0][IMP] product_variant_default_code: prefix_code as default_code…
Kev-Roche Sep 13, 2021
01bbc85
[UPD] Update product_variant_default_code.pot
oca-travis Sep 18, 2021
189ccde
product_variant_default_code 14.0.2.0.0
OCA-git-bot Sep 18, 2021
0b9e96e
Update translation files
oca-transbot Sep 18, 2021
975f567
[IMP] update dotfiles [ci skip]
OCA-git-bot Mar 31, 2022
b0af316
[FIX]product_variant_default_code add tests
Kev-Roche Nov 17, 2021
63b7cc8
[FIX] product_variant_default_code fixes
Kev-Roche Nov 17, 2021
08a6778
[FIX] no update when both code_prefix and reference_mask changing
Kev-Roche Jan 26, 2022
5367694
[UPD] Update product_variant_default_code.pot
oca-travis May 19, 2022
963adb8
[UPD] README.rst
OCA-git-bot May 19, 2022
f71ec74
product_variant_default_code 14.0.3.0.0
OCA-git-bot May 19, 2022
eb3a413
Update translation files
oca-transbot May 19, 2022
c095078
Translated using Weblate (Italian)
francesco-ooops May 31, 2022
23be056
Translated using Weblate (Italian)
SicurSam May 31, 2022
cd427f9
Translated using Weblate (Italian)
francesco-ooops May 31, 2022
a277e9f
Translated using Weblate (Italian)
francesco-ooops May 31, 2022
2691d10
[IMP][14.0] product tmpl default_code as default prefix_code
Kev-Roche Sep 7, 2022
75d85d3
product_variant_default_code 14.0.3.0.1
OCA-git-bot Feb 9, 2023
01893f1
[FIX][product_variant_default_code] check code of active value_ids
Kev-Roche Oct 26, 2022
b0b3299
[16.0][MIG] product_variant_default_code: migration to 16.0
Rferri44-S73 Mar 13, 2023
220f02b
[UPD] Update product_variant_default_code.pot
May 2, 2023
2d4bc3e
[UPD] README.rst
OCA-git-bot May 2, 2023
0258370
Update translation files
weblate May 2, 2023
cd33060
Revert "[FIX][product_variant_default_code] check code of active valu…
pedrobaeza May 3, 2023
eb99083
product_variant_default_code 16.0.1.0.1
OCA-git-bot May 3, 2023
6a50122
[FIX] product_variant_default_code: fix template error
pilarvargas-tecnativa May 6, 2023
d70bc2a
product_variant_default_code 16.0.1.0.2
OCA-git-bot May 6, 2023
4495e56
[IMP] product_variant_default_code: pre-commit auto fixes
arantxa-s73 Oct 16, 2024
49e27f9
[MIG] product_variant_default_code: Migration to 17.0
arantxa-s73 Oct 16, 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:0e25d0e9019dd6cfa4182b1688957555fc576f90f64d7a26c2cb9294253b5455
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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