From 72ec0050b442214c9be93907fc01a48832243c15 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 2 Jul 2015 17:01:05 +0200 Subject: [PATCH] [FIX] account: bank statement reconciliation To determine the account.move.line to reconcile, first it tries to match with the ref and the amount of the account.bank.statement.line and if it doesn't match, it just tries to match with the amount. opw:643867 --- addons/account/account_bank_statement.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index ad05ac662d4..9a4b83e1c5e 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -572,7 +572,11 @@ class account_bank_statement_line(osv.osv): # Look for a matching amount domain_exact_amount = domain + [(amount_field, '=', float_round(sign * amount, precision_digits=precision_digits))] - match_id = self.get_move_lines_for_reconciliation(cr, uid, st_line, excluded_ids=excluded_ids, offset=0, limit=2, additional_domain=domain_exact_amount) + domain_exact_amount_ref = domain_exact_amount + [('ref', '=', st_line.ref)] + match_id = self.get_move_lines_for_reconciliation(cr, uid, st_line, excluded_ids=excluded_ids, offset=0, limit=2, additional_domain=domain_exact_amount_ref) + if not match_id: + match_id = self.get_move_lines_for_reconciliation(cr, uid, st_line, excluded_ids=excluded_ids, offset=0, limit=2, additional_domain=domain_exact_amount) + if match_id and len(match_id) == 1: return match_id