diff --git a/product_code_unique/README.rst b/product_code_unique/README.rst index e713ab07012..907a073aae1 100644 --- a/product_code_unique/README.rst +++ b/product_code_unique/README.rst @@ -45,14 +45,6 @@ Usage 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 =========== diff --git a/product_code_unique/models/__init__.py b/product_code_unique/models/__init__.py index 2c3319d8df1..6340b36bc8a 100644 --- a/product_code_unique/models/__init__.py +++ b/product_code_unique/models/__init__.py @@ -1,4 +1,5 @@ # Copyright (C) 2018 - TODAY, Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from . import product +from . import product_product +from . import product_template diff --git a/product_code_unique/models/product.py b/product_code_unique/models/product_product.py similarity index 61% rename from product_code_unique/models/product.py rename to product_code_unique/models/product_product.py index 46744403d12..9ca1bf26e99 100644 --- a/product_code_unique/models/product.py +++ b/product_code_unique/models/product_product.py @@ -1,7 +1,7 @@ # Copyright (C) 2018 - TODAY, Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models +from odoo import api, models class ProductProduct(models.Model): @@ -14,3 +14,10 @@ class ProductProduct(models.Model): "Internal Reference must be unique across the database!", ) ] + + @api.onchange("default_code") + def _onchange_default_code(self): + res = super()._onchange_default_code() + if isinstance(res, dict): + res.pop("warning", None) + return res diff --git a/product_code_unique/models/product_template.py b/product_code_unique/models/product_template.py new file mode 100644 index 00000000000..991c1a6d56d --- /dev/null +++ b/product_code_unique/models/product_template.py @@ -0,0 +1,15 @@ +# Copyright 2026 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, models + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + @api.onchange("default_code") + def _onchange_default_code(self): + res = super()._onchange_default_code() + if isinstance(res, dict): + res.pop("warning", None) + return res diff --git a/product_code_unique/readme/ROADMAP.md b/product_code_unique/readme/ROADMAP.md deleted file mode 100644 index b06fa45223c..00000000000 --- a/product_code_unique/readme/ROADMAP.md +++ /dev/null @@ -1,4 +0,0 @@ -- 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". diff --git a/product_code_unique/static/description/index.html b/product_code_unique/static/description/index.html index 250461c2292..6ed813123d5 100644 --- a/product_code_unique/static/description/index.html +++ b/product_code_unique/static/description/index.html @@ -376,12 +376,11 @@

Unique Product Internal Reference

-
-

Known issues / Roadmap

- -
-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub 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 @@ -414,15 +404,15 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association