From aac190d37af2adce0d0ad7726bc2701e6c85f296 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 19 Oct 2010 10:37:52 +0300 Subject: [PATCH] account_cash_statement: complain where a new statement has no journal It wouldn't be able to create in either case, but have a more user-friendly message. bzr revid: p_christ@hol.gr-20101019073752-bpswr274h1lzctwm --- addons/account/account_cash_statement.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index f88d38734f2..454290c3c5f 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -241,6 +241,8 @@ class account_cash_statement(osv.osv): } def create(self, cr, uid, vals, context=None): + if 'journal_id' not in vals: + raise osv.except_osv('Error', _('You cannot create a bank or cash register without a journal!')) sql = [ ('journal_id', '=', vals['journal_id']), ('state', '=', 'open') @@ -381,4 +383,4 @@ class account_cash_statement(osv.osv): account_cash_statement() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: