[FIX] account: the encoding entries by line wasn't working if there was no journal of the type passed in context

bzr revid: qdp-launchpad@tinyerp.com-20100818144945-pb4n5x772iginqr7
This commit is contained in:
qdp-launchpad@tinyerp.com 2010-08-18 16:49:45 +02:00
parent 6fb7b48b84
commit 3d967d97d3
1 changed files with 2 additions and 0 deletions

View File

@ -47,6 +47,8 @@ class account_move_journal(osv.osv_memory):
journal_pool = self.pool.get('account.journal')
if context.get('journal_type', False):
jids = journal_pool.search(cr, uid, [('type','=', context.get('journal_type'))])
if not jids:
raise osv.except_osv(_('Configuration Error !'), _('Can\'t find any account journal of %s type for this company.\n\nYou can create one in the menu: \nConfiguration\Financial Accounting\Accounts\Journals.' % (context.get('journal_type'))))
journal_id = jids[0]
return journal_id