[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:
parent
85d5e95426
commit
3ca449046f
|
@ -1563,11 +1563,15 @@ class account_move_reconcile(osv.osv):
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'name': lambda self,cr,uid,ctx={}: self.pool.get('ir.sequence').get(cr, uid, 'account.reconcile') or '/',
|
'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):
|
def reconcile_partial_check(self, cr, uid, ids, type='auto', context=None):
|
||||||
total = 0.0
|
total = 0.0
|
||||||
for rec in self.browse(cr, uid, ids, context=context):
|
for rec in self.browse(cr, uid, ids, context=context):
|
||||||
for line in rec.line_partial_ids:
|
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:
|
if not total:
|
||||||
self.pool.get('account.move.line').write(cr, uid,
|
self.pool.get('account.move.line').write(cr, uid,
|
||||||
map(lambda x: x.id, rec.line_partial_ids),
|
map(lambda x: x.id, rec.line_partial_ids),
|
||||||
|
|
|
@ -749,11 +749,17 @@ class account_move_line(osv.osv):
|
||||||
if not line2.reconcile_id:
|
if not line2.reconcile_id:
|
||||||
if line2.id not in merges:
|
if line2.id not in merges:
|
||||||
merges.append(line2.id)
|
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)
|
merges_rec.append(line.reconcile_partial_id.id)
|
||||||
else:
|
else:
|
||||||
unmerge.append(line.id)
|
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):
|
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)
|
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
|
return res
|
||||||
|
|
Loading…
Reference in New Issue