[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
This commit is contained in:
Quentin (OpenERP) 2011-10-13 16:58:04 +02:00
parent 85d5e95426
commit 3ca449046f
2 changed files with 13 additions and 3 deletions

View File

@ -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),

View File

@ -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