From ef3bca400081bd9858e1b4f6bb623c3af74d0c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Schenkels?= Date: Mon, 29 May 2017 17:01:05 +0200 Subject: [PATCH] [FIX] Currency check / Limit [FIX] Changed if statement for currency check. Now it will also include the normal purchase invoices (not multicurrency) [FIX] Changed limit to 2 and added a check to see if more then 1 move line is returned. If so don't reconcile --- ..._statement_import_auto_reconcile_exact_amount.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/account_bank_statement_import_auto_reconcile/models/account_bank_statement_import_auto_reconcile_exact_amount.py b/account_bank_statement_import_auto_reconcile/models/account_bank_statement_import_auto_reconcile_exact_amount.py index 5973e76..4aa311b 100644 --- a/account_bank_statement_import_auto_reconcile/models/account_bank_statement_import_auto_reconcile_exact_amount.py +++ b/account_bank_statement_import_auto_reconcile/models/account_bank_statement_import_auto_reconcile_exact_amount.py @@ -29,11 +29,10 @@ class AccountBankStatementImportAutoReconcileExactAmount(models.AbstractModel): amount_field = 'debit' sign = 1 if statement_line.currency_id or statement_line.journal_id.currency: - if statement_line.amount < 0: - amount_field = 'credit' - sign = -1 - else: - amount_field = 'amount_currency' + amount_field = 'amount_currency' + elif statement_line.amount < 0: + amount_field = 'credit' + sign = -1 domain = [ '|', '|', '|', @@ -47,7 +46,7 @@ class AccountBankStatementImportAutoReconcileExactAmount(models.AbstractModel): ('partner_id', '=', statement_line.partner_id.id), (amount_field, '=', self._round(sign * statement_line.amount)), ] - move_lines = self.env['account.move.line'].search(domain, limit=1) - if move_lines: + move_lines = self.env['account.move.line'].search(domain, limit=2) + if move_lines and len(move_lines)==1: self._reconcile_move_line(statement_line, move_lines.id) return True