[FIX] account: fixed traceback when emptying the journal of a bank statement
bzr revid: qdp-launchpad@openerp.com-20120925071040-m9054w0qtt26ltjt
This commit is contained in:
parent
773ae0715b
commit
5165bf9c85
|
@ -447,11 +447,13 @@ class account_bank_statement(osv.osv):
|
|||
return self.write(cr, uid, done, {'state':'draft'}, context=context)
|
||||
|
||||
def _compute_balance_end_real(self, cr, uid, journal_id, context=None):
|
||||
cr.execute('SELECT balance_end_real \
|
||||
FROM account_bank_statement \
|
||||
WHERE journal_id = %s AND NOT state = %s \
|
||||
ORDER BY date DESC,id DESC LIMIT 1', (journal_id, 'draft'))
|
||||
res = cr.fetchone()
|
||||
res = False
|
||||
if journal_id:
|
||||
cr.execute('SELECT balance_end_real \
|
||||
FROM account_bank_statement \
|
||||
WHERE journal_id = %s AND NOT state = %s \
|
||||
ORDER BY date DESC,id DESC LIMIT 1', (journal_id, 'draft'))
|
||||
res = cr.fetchone()
|
||||
return res and res[0] or 0.0
|
||||
|
||||
def onchange_journal_id(self, cr, uid, statement_id, journal_id, context=None):
|
||||
|
|
Loading…
Reference in New Issue