From 3ca449046fe519676b4c988abb88d2ac788accb1 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 13 Oct 2011 16:58:04 +0200 Subject: [PATCH] [FIX] account: partial reconcile must look for amount_currency ONLY in the case there is a currency_id field set on the account reconciled bzr revid: qdp-launchpad@openerp.com-20111013145804-q7o0ye77yprriyoj --- addons/account/account.py | 6 +++++- addons/account/account_move_line.py | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 46e7b3457ec..c3ead387fba 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1563,11 +1563,15 @@ class account_move_reconcile(osv.osv): _defaults = { '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=None): total = 0.0 for rec in self.browse(cr, uid, ids, context=context): for line in rec.line_partial_ids: - total += (line.debit or 0.0) - (line.credit or 0.0) + if line.account_id.currency_id: + total += line.amount_currency + else: + total += (line.debit or 0.0) - (line.credit or 0.0) if not total: self.pool.get('account.move.line').write(cr, uid, map(lambda x: x.id, rec.line_partial_ids), diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 5de7fed2428..c18e6c318e0 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -749,11 +749,17 @@ class account_move_line(osv.osv): if not line2.reconcile_id: if line2.id not in merges: merges.append(line2.id) - total += (line2.debit or 0.0) - (line2.credit or 0.0) + if line2.account_id.currency_id: + total += line2.amount_currency + else: + total += (line2.debit or 0.0) - (line2.credit or 0.0) merges_rec.append(line.reconcile_partial_id.id) else: unmerge.append(line.id) - total += (line.debit or 0.0) - (line.credit or 0.0) + if line.account_id.currency_id: + total += line.amount_currency + else: + total += (line.debit or 0.0) - (line.credit or 0.0) if self.pool.get('res.currency').is_zero(cr, uid, company_currency_id, total): res = self.reconcile(cr, uid, merges+unmerge, context=context, writeoff_acc_id=writeoff_acc_id, writeoff_period_id=writeoff_period_id, writeoff_journal_id=writeoff_journal_id) return res