From 73f6400a1fc736d25995add13b9bb3d889de9382 Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Fri, 30 Jul 2010 17:46:56 +0530 Subject: [PATCH] [FIX]: fix a small bugs for the bank and cash statement bzr revid: mga@tinyerp.com-20100730121656-s63x4acjema3mgyo --- addons/account/account_cash_statement.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index d7162837d63..f618bcfeefd 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -235,11 +235,18 @@ class account_cash_statement(osv.osv): if open_jrnl: raise osv.except_osv('Error', _('You can not have two open register for the same journal')) - lines = end_lines = self._get_cash_close_box_lines(cr, uid, [], context) - vals.update({ - 'ending_details_ids':lines - }) + if self.pool.get('account.journal').browse(cr, uid, vals['journal_id']).type == 'cash': + lines = end_lines = self._get_cash_close_box_lines(cr, uid, [], context) + vals.update({ + 'ending_details_ids':lines + }) + else: + vals.update({ + 'ending_details_ids':False, + 'starting_details_ids':False + }) res_id = super(account_cash_statement, self).create(cr, uid, vals, context=context) + self.write(cr, uid, [res_id], {}) return res_id def write(self, cr, uid, ids, vals, context=None):