[FIX] account: Fix division by zero on register payment wizard
- Create an invoice having a foreign currency - Register a payment of 0.0 using a different currency with a write-off of any account => traceback Task: 2809565 X-original-commit: c86faecc980523fcfa6a3258f4c17bf30b41522c Part-of: odoo/odoo#87886
This commit is contained in:
@@ -573,7 +573,10 @@ class AccountPaymentRegister(models.TransientModel):
|
||||
if payment.currency_id != lines.currency_id:
|
||||
liquidity_lines, counterpart_lines, writeoff_lines = payment._seek_for_lines()
|
||||
source_balance = abs(sum(lines.mapped('amount_residual')))
|
||||
payment_rate = liquidity_lines[0].amount_currency / liquidity_lines[0].balance
|
||||
if liquidity_lines[0].balance:
|
||||
payment_rate = liquidity_lines[0].amount_currency / liquidity_lines[0].balance
|
||||
else:
|
||||
payment_rate = 0.0
|
||||
source_balance_converted = abs(source_balance) * payment_rate
|
||||
|
||||
# Translate the balance into the payment currency is order to be able to compare them.
|
||||
|
||||
Reference in New Issue
Block a user