Skip to content
Permalink
Browse files

[FIX] product: correctly pass pricelist arguments to recursive calls.

When computing the price of a product through a pricelist item, if the
item was based on anotherp pricelist, the dates and uom weren't given to
the subsequent method call.

As the majority of the calls to those pricelist methods put all their
arguments in the context, it wasn't noticed until now.

Functional example:
Pricelist A:
Rule A1 : 10% discount on Pricelist B, from day 3 to day 6.

Pricelist B:
Rule B1: 5% discount on Sales price, from day 3 to day 6,
Rule B2: 10% discount, from day 7 to day 9.

If today was day 8, the call to pricelist(A)._compute_price_rule(day=5)
would use rules A1 and B2, but should have used rules A1 and B1.

closes #40988

X-original-commit: fb0333a
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
  • Loading branch information
Feyensv committed Oct 21, 2019
1 parent a5dee68 commit 0ef6c2b8bfc6a33f86b23b55758522a9e9240770
Showing with 1 addition and 1 deletion.
  1. +1 −1 addons/product/models/product_pricelist.py
@@ -205,7 +205,7 @@ def _compute_price_rule(self, products_qty_partner, date=False, uom_id=False):
continue

if rule.base == 'pricelist' and rule.base_pricelist_id:
price_tmp = rule.base_pricelist_id._compute_price_rule([(product, qty, partner)])[product.id][0] # TDE: 0 = price, 1 = rule
price_tmp = rule.base_pricelist_id._compute_price_rule([(product, qty, partner)], date, uom_id)[product.id][0] # TDE: 0 = price, 1 = rule
price = rule.base_pricelist_id.currency_id.compute(price_tmp, self.currency_id, round=False)
else:
# if base option is public price take sale price else cost price of product

0 comments on commit 0ef6c2b

Please sign in to comment.
You can’t perform that action at this time.