[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) <vfe@odoo.com>
This commit is contained in:
Audric Onockx (auon)
2022-03-04 13:12:43 +00:00
committed by Victor Feyens
parent 3840959acf
commit 0910f071a7
2 changed files with 11 additions and 0 deletions
+8
View File
@@ -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
@@ -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):