diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 28722d53e0b..91d1a80bace 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -253,12 +253,16 @@ class AccountMoveLine(models.Model): amount += sign_partial_line * partial_line.amount #getting the date of the matched item to compute the amount_residual in currency - date = partial_line.credit_move_id.date if partial_line.debit_move_id == line else partial_line.debit_move_id.date if line.currency_id: if partial_line.currency_id and partial_line.currency_id == line.currency_id: amount_residual_currency += sign_partial_line * partial_line.amount_currency else: - amount_residual_currency += sign_partial_line * line.company_id.currency_id.with_context(date=date).compute(partial_line.amount, line.currency_id) + if line.balance and line.amount_currency: + rate = line.amount_currency / line.balance + else: + date = partial_line.credit_move_id.date if partial_line.debit_move_id == line else partial_line.debit_move_id.date + rate = line.currency_id.with_context(date=date).rate + amount_residual_currency += sign_partial_line * line.currency_id.round(partial_line.amount * rate) #computing the `reconciled` field. As we book exchange rate difference on each partial matching, #we can only check the amount in company currency