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_code_unique: migration to 17.0 #1568

Merged
merged 38 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6c8e1f3
[ADD] Module to add a constraint on the internal reference of the pro…
agyamuta Feb 28, 2018
14c8011
[UPD] Update product_code_unique.pot
oca-travis Jun 21, 2018
62a93e1
[MIG]product_code_unique: migration from 11 to 12
bizzappdev Nov 25, 2018
6e3ab11
[MIG] product_code_unique: Migration to 13.0
rven Oct 1, 2019
2f93237
[UPD] Update product_code_unique.pot
oca-travis Oct 7, 2019
47fa203
[UPD] README.rst
OCA-git-bot Oct 7, 2019
e45b9e7
pre-commit, black, isort
OCA-git-bot Oct 12, 2019
9b09767
[MIG] product_supplierinfo_for_customer: Migration to v13.0
sergio-teruel Feb 4, 2020
9f47ffe
[13.0][FIXUP] .isort.cfg
HviorForgeFlow Feb 26, 2020
4db9de5
[MIG] product_code_unique: Migration to 14.0
watthanun Nov 10, 2020
55a4dd3
[UPD] Update product_code_unique.pot
oca-travis Nov 17, 2020
2e805df
[UPD] README.rst
OCA-git-bot Nov 17, 2020
5d7edb9
Added translation using Weblate (French)
Yvesldff Apr 10, 2021
0b17b34
Translated using Weblate (French)
Yvesldff Apr 10, 2021
4f66ea7
Added translation using Weblate (French (France))
Yvesldff Apr 10, 2021
129a583
Translated using Weblate (French (France))
Yvesldff Apr 10, 2021
715cb40
[MIG] product_code_unique: Migration to 15.0
Jan 24, 2022
b165091
Added translation using Weblate (Catalan)
pablontura Apr 22, 2022
47d01c6
Translated using Weblate (Catalan)
pablontura Apr 22, 2022
060e2fa
Added translation using Weblate (German)
Apr 28, 2022
3edab8d
Translated using Weblate (German)
Apr 28, 2022
3b9c344
[MIG] product_code_unique: Migration to 16.0
marielejeune Sep 21, 2022
044930d
[UPD] Update product_code_unique.pot
Oct 19, 2022
1a2fb7a
[UPD] README.rst
OCA-git-bot Oct 19, 2022
e1cb54e
Update translation files
weblate Oct 19, 2022
1309d0c
Translated using Weblate (German)
marylla Nov 4, 2022
2e376df
Added translation using Weblate (Italian)
PicchiSeba Apr 27, 2023
26216e6
Translated using Weblate (Italian)
PicchiSeba Apr 27, 2023
5a1c11b
Added translation using Weblate (Portuguese)
pedrocs-exo Jul 12, 2023
4791899
Translated using Weblate (Portuguese)
pedrocs-exo Jul 12, 2023
22fdd01
[UPD] README.rst
OCA-git-bot Sep 3, 2023
678109e
[IMP] product_code_unique: test performance improvement
josep-tecnativa Oct 23, 2023
20eccfd
[BOT] post-merge updates
OCA-git-bot Oct 30, 2023
c52b2b2
Translated using Weblate (Italian)
mymage Nov 1, 2023
881d198
Added translation using Weblate (Spanish)
Ivorra78 Dec 29, 2023
00e2a8e
Translated using Weblate (Spanish)
Ivorra78 Dec 29, 2023
3c67b48
[MIG] product_code_unique: pre-commit
astirpe Mar 29, 2024
bddc095
[MIG] product_code_unique: migrate to V17
astirpe Mar 29, 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
97 changes: 97 additions & 0 deletions product_code_unique/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
=================================
Unique Product Internal Reference
=================================

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

.. |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--attribute-lightgray.png?logo=github
:target: https://github.com/OCA/product-attribute/tree/17.0/product_code_unique
: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-17-0/product-attribute-17-0-product_code_unique
: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=17.0
:alt: Try me on Runboat

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

This module adds a constraint on the internal reference of the product
to make it unique across the database.

**Table of contents**

.. contents::
:local:

Usage
=====

- Unable to save a product when a new internal reference or
default_code value is the same with an existing record.
- A pre_init_hook process is initiated when there exist records without
an internal reference(default_code). A default value is generated to
populate empty field as a temporary value.

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

- Avoid duplicate warnings. Odoo has a warning for duplicate "Internal
Reference" of its own (it doesn't block from saving). Now both
warnings are displayed when trying to save a duplicate "Internal
Reference".

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_code_unique%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
-------

* Open Source Integrators

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

- Antonio Yamuta <ayamuta@opensourceintegrators.com>
- Raf Ven <raf.ven@dynapps.be>
- Watthanun Khorchai <watthanun_t@hotmail.com>
- Nedas Žilinskas <nedas.zilinskas@web-veistamo.fi>

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.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions product_code_unique/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (C) 2018 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
from .hook import pre_init_product_code
15 changes: 15 additions & 0 deletions product_code_unique/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (C) 2018 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Unique Product Internal Reference",
"summary": "Set Product Internal Reference as Unique",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"category": "Product",
"website": "https://github.com/OCA/product-attribute",
"depends": ["product"],
"pre_init_hook": "pre_init_product_code",
"installable": True,
}
19 changes: 19 additions & 0 deletions product_code_unique/hook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (C) 2019 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


def pre_init_product_code(env):
env.cr.execute(
"""UPDATE product_product
SET default_code = 'DEFAULT' || nextval('ir_default_id_seq')
WHERE id in (SELECT distinct(pp.id)
FROM product_product pp
INNER JOIN (SELECT default_code, COUNT(*)
FROM product_product
GROUP BY default_code
HAVING COUNT(*)>1
)pp1 on pp.default_code=pp1.default_code
or pp.default_code is NULL
or LENGTH(pp.default_code) = 0)"""
)
return True
30 changes: 30 additions & 0 deletions product_code_unique/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_code_unique
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2022-04-22 10:05+0000\n"
"Last-Translator: pablontura <pablo.ruiz@qubiq.es>\n"
"Language-Team: none\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: product_code_unique
#: model:ir.model.constraint,message:product_code_unique.constraint_product_product_default_code_uniq
msgid "Internal Reference must be unique across the database!"
msgstr "La referència interna ha de ser única a tota la base de dades!"

#. module: product_code_unique
#: model:ir.model,name:product_code_unique.model_product_product
msgid "Product Variant"
msgstr ""

#~ msgid "Product"
#~ msgstr "Producte"
31 changes: 31 additions & 0 deletions product_code_unique/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_code_unique
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2022-11-04 14:44+0000\n"
"Last-Translator: Maria Sparenberg <maria.sparenberg@gmx.net>\n"
"Language-Team: none\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.14.1\n"

#. module: product_code_unique
#: model:ir.model.constraint,message:product_code_unique.constraint_product_product_default_code_uniq
msgid "Internal Reference must be unique across the database!"
msgstr ""
"Die Interne Referenz muss eindeutig sein, Duplikate sind nicht zugelassen!"

#. module: product_code_unique
#: model:ir.model,name:product_code_unique.model_product_product
msgid "Product Variant"
msgstr "Produktvariante"

#~ msgid "Product"
#~ msgstr "Produkt"
27 changes: 27 additions & 0 deletions product_code_unique/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_code_unique
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-12-29 11:34+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: product_code_unique
#: model:ir.model.constraint,message:product_code_unique.constraint_product_product_default_code_uniq
msgid "Internal Reference must be unique across the database!"
msgstr "¡La Referencia Interna debe ser única en toda la base de datos!"

#. module: product_code_unique
#: model:ir.model,name:product_code_unique.model_product_product
msgid "Product Variant"
msgstr "Variante del Producto"
36 changes: 36 additions & 0 deletions product_code_unique/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_code_unique
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-04-10 11:46+0000\n"
"Last-Translator: Yves Le Doeuff <yld@alliasys.fr>\n"
"Language-Team: none\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: product_code_unique
#: model:ir.model.constraint,message:product_code_unique.constraint_product_product_default_code_uniq
msgid "Internal Reference must be unique across the database!"
msgstr "La référence interne doit être unique !"

#. module: product_code_unique
#: model:ir.model,name:product_code_unique.model_product_product
msgid "Product Variant"
msgstr ""

#~ msgid "Display Name"
#~ msgstr "Nom affiché"

#~ msgid "Last Modified on"
#~ msgstr "Dernière modification"

#~ msgid "Product"
#~ msgstr "Article"
36 changes: 36 additions & 0 deletions product_code_unique/i18n/fr_FR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_code_unique
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-04-10 15:46+0000\n"
"Last-Translator: Yves Le Doeuff <yld@alliasys.fr>\n"
"Language-Team: none\n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: product_code_unique
#: model:ir.model.constraint,message:product_code_unique.constraint_product_product_default_code_uniq
msgid "Internal Reference must be unique across the database!"
msgstr "La référence interne doit être unique !"

#. module: product_code_unique
#: model:ir.model,name:product_code_unique.model_product_product
msgid "Product Variant"
msgstr ""

#~ msgid "Display Name"
#~ msgstr "Nom affiché"

#~ msgid "Last Modified on"
#~ msgstr "Dernière modification"

#~ msgid "Product"
#~ msgstr "Article"
27 changes: 27 additions & 0 deletions product_code_unique/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_code_unique
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-01 12:37+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: product_code_unique
#: model:ir.model.constraint,message:product_code_unique.constraint_product_product_default_code_uniq
msgid "Internal Reference must be unique across the database!"
msgstr "Il riferimento interno deve essere unico all'interno del database!"

#. module: product_code_unique
#: model:ir.model,name:product_code_unique.model_product_product
msgid "Product Variant"
msgstr "Variante prodotto"
24 changes: 24 additions & 0 deletions product_code_unique/i18n/product_code_unique.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_code_unique
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: product_code_unique
#: model:ir.model.constraint,message:product_code_unique.constraint_product_product_default_code_uniq
msgid "Internal Reference must be unique across the database!"
msgstr ""

#. module: product_code_unique
#: model:ir.model,name:product_code_unique.model_product_product
msgid "Product Variant"
msgstr ""
27 changes: 27 additions & 0 deletions product_code_unique/i18n/pt.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_code_unique
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-07-13 00:11+0000\n"
"Last-Translator: Pedro Castro Silva <pedrocs@exo.pt>\n"
"Language-Team: none\n"
"Language: pt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: product_code_unique
#: model:ir.model.constraint,message:product_code_unique.constraint_product_product_default_code_uniq
msgid "Internal Reference must be unique across the database!"
msgstr "A Referência Interna tem que ser única na base de dados!"

#. module: product_code_unique
#: model:ir.model,name:product_code_unique.model_product_product
msgid "Product Variant"
msgstr "Variante de Produto"
4 changes: 4 additions & 0 deletions product_code_unique/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (C) 2018 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import product
Loading
Loading