[FIX] sale_coupon(_delivery): Filter the taxes by company.

In this case for scenario with multi-company, the new line of the reward product, should be set with the taxes for company of the current sale order.
Before this change the taxes that are selected were for the all companies setted in the product.

closes odoo/odoo#68029

X-original-commit: eb6ba44a6bfd0ebfce887edc307e0306765e5183
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
Nicolás Mac Rouillon
2021-03-17 15:09:46 +00:00
committed by Victor Feyens
parent c734e975a3
commit af13260873
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -99,7 +99,8 @@ class SaleOrder(models.Model):
reward_qty = min(int(int(max_product_qty / program.rule_min_quantity) * program.reward_product_quantity), reward_product_qty)
# Take the default taxes on the reward product, mapped with the fiscal position
taxes = self.fiscal_position_id.map_tax(program.reward_product_id.taxes_id)
taxes = program.reward_product_id.taxes_id.filtered(lambda t: t.company_id.id == self.company_id.id)
taxes = self.fiscal_position_id.map_tax(taxes)
return {
'product_id': program.discount_line_product_id.id,
'price_unit': - price_unit,
@@ -26,7 +26,8 @@ class SaleOrder(models.Model):
def _get_reward_values_free_shipping(self, program):
delivery_line = self.order_line.filtered(lambda x: x.is_delivery)
taxes = self.fiscal_position_id.map_tax(delivery_line.product_id.taxes_id)
taxes = delivery_line.product_id.taxes_id.filtered(lambda t: t.company_id.id == self.company_id.id)
taxes = self.fiscal_position_id.map_tax(taxes)
return {
'name': _("Discount: %s", program.name),
'product_id': program.discount_line_product_id.id,