[FIX] account: use company currency in _compute_matched_percentage in case no currency is set on account.move
When a move or move line is supposed to use the company currency, its currency_id field is empty. _compute_matched_percentage did not take this into account, causing the rounding method to sometimes be called with a precision equal to False, resulting in erronous and weird behavior (0 was considered different from 0, causing a division by zero in the following condition).
This commit is contained in:
@@ -55,7 +55,8 @@ class AccountMove(models.Model):
|
||||
total_amount += amount
|
||||
for partial_line in (line.matched_debit_ids + line.matched_credit_ids):
|
||||
total_reconciled += partial_line.amount
|
||||
if float_is_zero(total_amount, precision_rounding=move.currency_id.rounding):
|
||||
precision_currency = move.currency_id or move.company_id.currency_id
|
||||
if float_is_zero(total_amount, precision_rounding=precision_currency.rounding):
|
||||
move.matched_percentage = 1.0
|
||||
else:
|
||||
move.matched_percentage = total_reconciled / total_amount
|
||||
|
||||
Reference in New Issue
Block a user