[FIX] account_voucher: getting default invoice crashes
authorRaphael Collet <rco@openerp.com>
Thu, 13 Nov 2014 11:42:18 +0000 (12:42 +0100)
committerRaphael Collet <rco@openerp.com>
Thu, 13 Nov 2014 13:48:53 +0000 (14:48 +0100)
Fixes #3524.

addons/account_voucher/account_voucher.py

index e1483ab..78060e8 100644 (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