From 71e10bc650f7a71e9cf7d92e7ac86cb70b2f8ced Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Fri, 9 Jun 2023 13:20:24 +0000 Subject: [PATCH] [FIX] sale: multi-company conflict at reinvoicing Since d88409e8e5ce77ff3ec3b24fcdc108d8df380994, taxes from different companies are forbidden on sale.order.line records (which is the expected behavior). Nonetheless, this highlighted some flows where the taxes were not properly set/recomputed, especially re-invoicing, which is fixed by the current commit. Fixes #123675 closes odoo/odoo#125434 X-original-commit: 6ce4019968bd0a1a11475910d35aa2ccfc2c6a9a Signed-off-by: Victor Feyens (vfe) --- addons/sale/models/account_move_line.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/sale/models/account_move_line.py b/addons/sale/models/account_move_line.py index 5e989dac515..e64cc2747e9 100644 --- a/addons/sale/models/account_move_line.py +++ b/addons/sale/models/account_move_line.py @@ -155,7 +155,8 @@ class AccountMoveLine(models.Model): last_sequence = last_so_line.sequence + 1 if last_so_line else 100 fpos = order.fiscal_position_id or order.fiscal_position_id._get_fiscal_position(order.partner_id) - taxes = fpos.map_tax(self.product_id.taxes_id) + product_taxes = self.product_id.taxes_id.filtered(lambda tax: tax.company_id == order.company_id) + taxes = fpos.map_tax(product_taxes) return { 'order_id': order.id,