From 5d5c4607841113cbdba9e48ee86917c470b2ba03 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 8 Oct 2020 08:47:28 +0000 Subject: [PATCH] [FIX] account: Updating currency on Vendor bill Steps to reproduce the bug: - Enable Multi-Currencies and Multi-Companies - Create a vendor bill - Remove the default journal - Set an other currencies Bug: A traceback was raised opw:2350490 closes odoo/odoo#59546 X-original-commit: d9f8efcc330bc7454411aad3546de663424724f7 Signed-off-by: Simon Goffin (sig) Signed-off-by: oco-odoo --- addons/account/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 5c2b4a6668d..be8aa5759dc 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -951,7 +951,7 @@ class AccountMove(models.Model): existing_terms_lines = self.line_ids.filtered(lambda line: line.account_id.user_type_id.type in ('receivable', 'payable')) others_lines = self.line_ids.filtered(lambda line: line.account_id.user_type_id.type not in ('receivable', 'payable')) - company_currency_id = self.company_id.currency_id + company_currency_id = (self.company_id or self.env.company).currency_id total_balance = sum(others_lines.mapped(lambda l: company_currency_id.round(l.balance))) total_amount_currency = sum(others_lines.mapped('amount_currency'))