From bc05fe262cb0fce7a5ae772fcb2448725db973b7 Mon Sep 17 00:00:00 2001
From: qdp-odoo <qdp@openerp.com>
Date: Wed, 18 Jun 2014 14:37:29 +0200
Subject: [PATCH] [FIX] account: fixed the proposal of reconciliation in the
 bank statement for negative amounts

---
 addons/account/account_bank_statement.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index 99a869c6b164..1ddab4bece93 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -409,6 +409,10 @@ class account_bank_statement(osv.osv):
             'domain':[('statement_id','in',ids)],
             'context':ctx,
         }
+
+    def number_of_lines_reconciled(self, cr, uid, id, context=None):
+        bsl_obj = self.pool.get('account.bank.statement.line')
+        return bsl_obj.search_count(cr, uid, [('statement_id', '=', id), ('journal_entry_id', '!=', False)], context=context)
         
     def get_format_currency_js_function(self, cr, uid, id, context=None):
         """ Returns a string that can be used to instanciate a javascript function.
@@ -432,10 +436,6 @@ class account_bank_statement(osv.osv):
                 done_currencies.append(st_line_currency.id)
         return function
 
-    def number_of_lines_reconciled(self, cr, uid, id, context=None):
-        bsl_obj = self.pool.get('account.bank.statement.line')
-        return bsl_obj.search_count(cr, uid, [('statement_id', '=', id), ('journal_entry_id', '!=', False)], context=context)
-
     def link_bank_to_partner(self, cr, uid, ids, context=None):
         for statement in self.browse(cr, uid, ids, context=context):
             for st_line in statement.line_ids:
@@ -554,7 +554,7 @@ class account_bank_statement_line(osv.osv):
             if total + line[amount_field] <= abs(st_line.amount):
                 ret.append(line)
                 total += line[amount_field]
-            if total >= st_line.amount:
+            if total >= abs(st_line.amount):
                 break
         return ret
 
-- 
GitLab