Skip to content

Commit

Permalink
[FIX]account: Accounting reconciliation problem
Browse files Browse the repository at this point in the history
Steps to reproduce the bug:
-Activate multi currency
-Set the receivable account with the same currency of the company.
-Create a customer invoice in the currency of the company
-Register a payment for this invoice

Bug:
The payment was not reconciliated with the invoice.

opw:1826121
  • Loading branch information
simongoffin committed Mar 19, 2018
1 parent b25250f commit d821f37
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions addons/account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,9 @@ def process_reconciliation(self, new_mv_line_dicts):

def _get_pair_to_reconcile(self):
#field is either 'amount_residual' or 'amount_residual_currency' (if the reconciled account has a secondary currency set)
field = self[0].account_id.currency_id and 'amount_residual_currency' or 'amount_residual'
company_currency_id = self[0].account_id.company_id.currency_id
account_curreny_id = self[0].account_id.currency_id
field = (account_curreny_id and company_currency_id != account_curreny_id) and 'amount_residual_currency' or 'amount_residual'
#reconciliation on bank accounts are special cases as we don't want to set them as reconciliable
#but we still want to reconcile entries that are reversed together in order to clear those lines
#in the bank reconciliation report.
Expand Down Expand Up @@ -946,8 +948,9 @@ def auto_reconcile_lines(self):
#there is no more pair to reconcile so return what move_line are left
if not sm_credit_move or not sm_debit_move:
return self

field = self[0].account_id.currency_id and 'amount_residual_currency' or 'amount_residual'
company_currency_id = self[0].account_id.company_id.currency_id
account_curreny_id = self[0].account_id.currency_id
field = (account_curreny_id and company_currency_id != account_curreny_id) and 'amount_residual_currency' or 'amount_residual'
if not sm_debit_move.debit and not sm_debit_move.credit:
#both debit and credit field are 0, consider the amount_residual_currency field because it's an exchange difference entry
field = 'amount_residual_currency'
Expand Down

0 comments on commit d821f37

Please sign in to comment.