From 0910f071a71ec94314bdd32c8b691f947549ee27 Mon Sep 17 00:00:00 2001 From: "Audric Onockx (auon)" Date: Thu, 24 Feb 2022 14:04:57 +0000 Subject: [PATCH] [FIX] product : apply only active price rules Steps : Install Sale / E-commerce. Create product P (price = 100). Create price list L. Create price rule R (product = P, price = 50). Go to product P > Price Rules > archive R. Create a quotation. / Website > click 'Go to website' > Shop. Select price list L. Create a SOL with product P. / Search for product P. Issue : Price is 50. Cause : Archived price rules are included in the 'search' of _compute_price_rule_get_items(). Fix : Exclude them. opw-2752184 closes odoo/odoo#85811 X-original-commit: d5e8308492ac8955ad76fd8d9f3781266dee76f6 Signed-off-by: Victor Feyens (vfe) --- addons/product/i18n/product.pot | 8 ++++++++ addons/product/models/product_pricelist_item.py | 3 +++ 2 files changed, 11 insertions(+) diff --git a/addons/product/i18n/product.pot b/addons/product/i18n/product.pot index 963680d61f1..f0a8e05da9d 100644 --- a/addons/product/i18n/product.pot +++ b/addons/product/i18n/product.pot @@ -2820,6 +2820,14 @@ msgid "" "You cannot move the attribute %s from the product %s to the product %s." msgstr "" +#. module: product +#: code:addons/product/models/product_pricelist.py:0 +#, python-format +msgid "" +"You cannot disable a pricelist rule, please delete it or archive its " +"pricelist instead." +msgstr "" + #. module: product #: code:addons/product/models/product_attribute.py:0 #: code:addons/product/models/product_attribute.py:0 diff --git a/addons/product/models/product_pricelist_item.py b/addons/product/models/product_pricelist_item.py index 8c268a1640f..8c64ba45c70 100644 --- a/addons/product/models/product_pricelist_item.py +++ b/addons/product/models/product_pricelist_item.py @@ -295,6 +295,9 @@ class PricelistItem(models.Model): values.update(dict(categ_id=None)) return super().write(values) + def toggle_active(self): + raise ValidationError(_("You cannot disable a pricelist rule, please delete it or archive its pricelist instead.")) + #=== BUSINESS METHODS ===# def _is_applicable_for(self, product, qty_in_product_uom):