[FIX] sale_loyalty: fix pricing on free products

Previously free products from loyalty programs were given as the product
with a price_unit of 0, it will now have the complete price but with a
100% discount instead.

closes odoo/odoo#89691

X-original-commit: 39202e71b0df2f5f6d8bfec54e21b4ae4d899b7f
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
This commit is contained in:
William Braeckman
2022-04-27 07:51:51 +02:00
parent e9237ae800
commit ad48cd1de8
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -139,7 +139,7 @@ class SaleOrder(models.Model):
return [{
'name': _("Free Product - %(product)s", product=product.name),
'product_id': product.id,
'price_unit': 0,
'discount': 100,
'product_uom_qty': reward.reward_product_qty * claimable_count,
'reward_id': reward.id,
'coupon_id': coupon.id,
@@ -40,7 +40,7 @@ class SaleOrderLine(models.Model):
def _get_display_price(self):
# A product created from a promotion does not have a list_price.
# The price_unit of a reward order line is computed by the promotion, so it can be used directly
if self.is_reward_line:
if self.is_reward_line and self.reward_id.reward_type != 'product':
return self.price_unit
return super()._get_display_price()