From 905d308e99d6e0d738688eb94f30f29f20bccb79 Mon Sep 17 00:00:00 2001 From: alexis-anthonissen Date: Wed, 7 Jan 2026 17:10:23 +0100 Subject: [PATCH] [FIX] product_code_unique - remove duplicate warning for "Internal Reference" --- product_code_unique/models/__init__.py | 3 ++- .../models/{product.py => product_product.py} | 6 +++++- product_code_unique/models/product_template.py | 12 ++++++++++++ product_code_unique/readme/ROADMAP.md | 4 ---- 4 files changed, 19 insertions(+), 6 deletions(-) rename product_code_unique/models/{product.py => product_product.py} (78%) create mode 100644 product_code_unique/models/product_template.py delete mode 100644 product_code_unique/readme/ROADMAP.md 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 78% rename from product_code_unique/models/product.py rename to product_code_unique/models/product_product.py index 46744403d12..51e508aef24 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,7 @@ class ProductProduct(models.Model): "Internal Reference must be unique across the database!", ) ] + + @api.onchange() + def _onchange_default_code(self): + return diff --git a/product_code_unique/models/product_template.py b/product_code_unique/models/product_template.py new file mode 100644 index 00000000000..7be9d5416f4 --- /dev/null +++ b/product_code_unique/models/product_template.py @@ -0,0 +1,12 @@ +# 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() + def _onchange_default_code(self): + return 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".