From af13260873aa939907ccb74aaec0047d63169f9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Mac=20Rouillon?= Date: Mon, 21 Dec 2020 14:52:04 +0000 Subject: [PATCH] [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) --- addons/sale_coupon/models/sale_order.py | 3 ++- addons/sale_coupon_delivery/models/sale_order.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/sale_coupon/models/sale_order.py b/addons/sale_coupon/models/sale_order.py index c74e0a22ded..c8c3035e704 100644 --- a/addons/sale_coupon/models/sale_order.py +++ b/addons/sale_coupon/models/sale_order.py @@ -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, diff --git a/addons/sale_coupon_delivery/models/sale_order.py b/addons/sale_coupon_delivery/models/sale_order.py index 17cb9eace3a..96e01274eb0 100644 --- a/addons/sale_coupon_delivery/models/sale_order.py +++ b/addons/sale_coupon_delivery/models/sale_order.py @@ -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,