Skip to content

Commit

Permalink
[FIX] sale: fix no_variant price extra context propagation
Browse files Browse the repository at this point in the history
Issue

	- Install Sales
	- Enable discounts & pricelists
	- Create a product
		- 2 variants:
			- first with "create variant" set to Always
			- second set to Never
	- Create a SO
	- Pricelist setting "without_discount"
	- Add the product with product configurator

	The line price is not correct (only Always taken in account)

Cause

	When the variant has Create Variant set to Never
	we pass the extra money in the context.

	When we have a pricelist with "without_discount"
	this context is not propagated correctly and it's lost

Solution

	Pass the product directly if it's not empty which
	have the context set.

OPW-2246102

closes odoo#53200

X-original-commit: 6862820
Signed-off-by: Nicolas Martinelli (nim) <[email protected]>
Signed-off-by: Jason Van Malder (jvm) <[email protected]>
  • Loading branch information
jvm-odoo committed Jun 18, 2020
1 parent ba98024 commit 19b936b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/sale/models/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ def _get_display_price(self, product):
return product.with_context(pricelist=self.order_id.pricelist_id.id).price
product_context = dict(self.env.context, partner_id=self.order_id.partner_id.id, date=self.order_id.date_order, uom=self.product_uom.id)

final_price, rule_id = self.order_id.pricelist_id.with_context(product_context).get_product_price_rule(self.product_id, self.product_uom_qty or 1.0, self.order_id.partner_id)
final_price, rule_id = self.order_id.pricelist_id.with_context(product_context).get_product_price_rule(product or self.product_id, self.product_uom_qty or 1.0, self.order_id.partner_id)
base_price, currency = self.with_context(product_context)._get_real_price_currency(product, rule_id, self.product_uom_qty, self.product_uom, self.order_id.pricelist_id.id)
if currency != self.order_id.pricelist_id.currency_id:
base_price = currency._convert(
Expand Down

0 comments on commit 19b936b

Please sign in to comment.