-
-
Notifications
You must be signed in to change notification settings - Fork 720
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by gurneyalex
- Loading branch information
Showing
23 changed files
with
890 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <[email protected]> | ||
- Raf Ven <[email protected]> | ||
- Watthanun Khorchai <[email protected]> | ||
- Nedas Žilinskas <[email protected]> | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <[email protected]>\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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <[email protected]>\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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <[email protected]>\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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <[email protected]>\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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <[email protected]>\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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <[email protected]>\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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <[email protected]>\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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.