From 81796ce1073f62574c9833bc126f51e5be4229ac Mon Sep 17 00:00:00 2001 From: JordiMForgeFlow Date: Mon, 3 Feb 2025 16:40:03 +0100 Subject: [PATCH] [IMP] account_invoice_show_currency_rate: prevent error when balance is zero --- account_invoice_show_currency_rate/models/account_move.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/account_invoice_show_currency_rate/models/account_move.py b/account_invoice_show_currency_rate/models/account_move.py index ed6a48d9b61..44e92a91caa 100644 --- a/account_invoice_show_currency_rate/models/account_move.py +++ b/account_invoice_show_currency_rate/models/account_move.py @@ -71,7 +71,9 @@ def _compute_currency_rate(self): for line in self: if line.move_id.state != "posted" or not line.amount_currency: continue - line.currency_rate = line.currency_id.round( - abs(line.amount_currency) / abs(line.balance) + line.currency_rate = ( + line.currency_id.round(abs(line.amount_currency) / abs(line.balance)) + if line.balance + else 0 ) return res