[FIX] account: partial reconcile now use is_zero function of res.currency to avoid...
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>
Thu, 8 Sep 2011 14:35:46 +0000 (16:35 +0200)
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>
Thu, 8 Sep 2011 14:35:46 +0000 (16:35 +0200)
bzr revid: qdp-launchpad@openerp.com-20110908143546-zidecijbi0kzi3n2

addons/account/account.py
addons/account/account_move_line.py

index 5782e12..6359906 100644 (file)
@@ -1246,11 +1246,13 @@ class account_move_reconcile(osv.osv):
         'name': lambda self,cr,uid,ctx={}: self.pool.get('ir.sequence').get(cr, uid, 'account.reconcile') or '/',
     }
     def reconcile_partial_check(self, cr, uid, ids, type='auto', context={}):
-        total = 0.0 
+        total = 0.0
+        currency_rec = False
         for rec in self.browse(cr, uid, ids, context):
             for line in rec.line_partial_ids:
+                currency_rec = line.account_id.company_id.currency_id
                 total += (line.debit or 0.0) - (line.credit or 0.0)
-        if not total:
+        if currency_rec and self.pool.get('res.currency').is_zero(cr, uid, currency_rec, total):
             self.pool.get('account.move.line').write(cr, uid,
                 map(lambda x: x.id, rec.line_partial_ids),
                 {'reconcile_id': rec.id }
index 9bcd71e..7cd9667 100644 (file)
@@ -517,7 +517,9 @@ class account_move_line(osv.osv):
         unmerge = []
         total = 0.0
         merges_rec = []
+        currency_rec = False
         for line in self.browse(cr, uid, ids, context):
+            currency_rec = line.account_id.company_id.currency_id
             if line.reconcile_id:
                 raise osv.except_osv(_('Already Reconciled'), _('Already Reconciled'))
             if line.reconcile_partial_id:
@@ -530,8 +532,7 @@ class account_move_line(osv.osv):
             else:
                 unmerge.append(line.id)
                 total += (line.debit or 0.0) - (line.credit or 0.0)
-
-        if not total:
+        if currency_rec and self.pool.get('res.currency').is_zero(cr, uid, currency_rec, total):
             res = self.reconcile(cr, uid, merges+unmerge, context=context)
             return res
         r_id = self.pool.get('account.move.reconcile').create(cr, uid, {