From dfc49f15455d51c4d9d19fedb50c7e1175f555c7 Mon Sep 17 00:00:00 2001 From: AMZIL Ayoub Date: Tue, 12 Dec 2023 11:21:44 +0100 Subject: [PATCH] [FIX] account, sale, purchase: fix multi invoice/quotation/purchase printing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The issue: having 2 invoices/quotations/purchase orders with different customer, each customer has a different language, the 'Unaxed amount' string will get translated into the first language of the first invoice partner. The fix: recompute the total when the lang context change opw-3569173 closes odoo/odoo#146311 X-original-commit: d48a09738bdde4050bc75f82480ff47ddeb8b553 Signed-off-by: Habib Ayob (ayh) Signed-off-by: William André (wan) --- addons/account/models/account_move.py | 1 + addons/purchase/models/purchase_order.py | 1 + addons/sale/models/sale_order.py | 1 + 3 files changed, 3 insertions(+) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index b10bff7d2ab..bc00797a467 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1212,6 +1212,7 @@ class AccountMove(models.Model): else: move.invoice_payments_widget = False + @api.depends_context('lang') @api.depends( 'invoice_line_ids.currency_rate', 'invoice_line_ids.tax_base_amount', diff --git a/addons/purchase/models/purchase_order.py b/addons/purchase/models/purchase_order.py index 3ffcc6f5a54..8e7a2631b17 100644 --- a/addons/purchase/models/purchase_order.py +++ b/addons/purchase/models/purchase_order.py @@ -197,6 +197,7 @@ class PurchaseOrder(models.Model): name += ': ' + formatLang(self.env, po.amount_total, currency_obj=po.currency_id) po.display_name = name + @api.depends_context('lang') @api.depends('order_line.taxes_id', 'order_line.price_subtotal', 'amount_total', 'amount_untaxed') def _compute_tax_totals(self): for order in self: diff --git a/addons/sale/models/sale_order.py b/addons/sale/models/sale_order.py index 7a52ab599fa..6a9148dd2f8 100644 --- a/addons/sale/models/sale_order.py +++ b/addons/sale/models/sale_order.py @@ -640,6 +640,7 @@ class SaleOrder(models.Model): current_amount=(order.amount_total / order.currency_rate), ) + @api.depends_context('lang') @api.depends('order_line.tax_id', 'order_line.price_unit', 'amount_total', 'amount_untaxed', 'currency_id') def _compute_tax_totals(self): for order in self: