[FIX] account_voucher: getting default invoice crashes

Fixes #3524.
This commit is contained in:
Raphael Collet 2014-11-13 12:42:18 +01:00
parent d978c78246
commit e3580ab884
1 changed files with 3 additions and 0 deletions

View File

@ -125,6 +125,9 @@ class account_voucher(osv.osv):
journal_pool = self.pool.get('account.journal')
journal_id = context.get('journal_id', False)
if journal_id:
if isinstance(journal_id, (list, tuple)):
# sometimes journal_id is a pair (id, display_name)
journal_id = journal_id[0]
journal = journal_pool.browse(cr, uid, journal_id, context=context)
if journal.currency:
return journal.currency.id