[FIX] sale_loyalty: reset taxes on payment program lines

Since we reuse sale order lines as much as possible, having reward lines
with no tax means that we need to explicitely reset the taxes on those
lines. However this was not done before.

TaskId-3138483

closes odoo/odoo#110785

X-original-commit: e945526f3a69d0adaa283c9a5aa4f5dde6027e4e
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
This commit is contained in:
William Braeckman
2023-01-24 09:12:01 +01:00
parent d941333582
commit a35dd0d43f
+2
View File
@@ -309,6 +309,7 @@ class SaleOrder(models.Model):
'points_cost': 0,
'reward_identifier_code': _generate_random_reward_code(),
'sequence': sequence,
'tax_id': [(Command.CLEAR, 0, 0)]
}]
raise UserError(_('There is nothing to discount'))
max_discount = reward.currency_id._convert(reward.discount_max_amount, self.currency_id, self.company_id, fields.Date.today()) or float('inf')
@@ -341,6 +342,7 @@ class SaleOrder(models.Model):
'points_cost': point_cost,
'reward_identifier_code': reward_code,
'sequence': sequence,
'tax_id': [(Command.CLEAR, 0, 0)],
}]
discount_factor = min(1, (max_discount / discountable)) if discountable else 1
mapped_taxes = {tax: self.fiscal_position_id.map_tax(tax) for tax in discountable_per_tax}