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
This commit is contained in:
P. Christeas 2010-10-19 10:37:52 +03:00
parent ddb8793c9b
commit aac190d37a
1 changed files with 3 additions and 1 deletions

View File

@ -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:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: