From c1e0521566c9c8b893b424f6b03d2ea65d845f55 Mon Sep 17 00:00:00 2001 From: Amit Dodiya Date: Fri, 8 Mar 2013 18:32:27 +0530 Subject: [PATCH] [FIX]: account: when we create invoice from portal menu got the error becuase in context we have passed list in type so code cannot handle the list bzr revid: ado@tinyerp.com-20130308130227-bvm08cab4gjkco71 --- addons/account/account_invoice.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 17135ed1f76..269a2367c5f 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -53,9 +53,12 @@ class account_invoice(osv.osv): company_id = context.get('company_id', user.company_id.id) type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale_refund', 'in_refund': 'purchase_refund'} journal_obj = self.pool.get('account.journal') - res = journal_obj.search(cr, uid, [('type', '=', type2journal.get(type_inv, 'sale')), - ('company_id', '=', company_id)], - limit=1) + domain = [('company_id', '=', company_id)] + if isinstance(type_inv, list): + domain.append(('type', 'in', [type2journal.get(type) for type in type_inv if type2journal.get(type)])) + else: + domain.append(('type', '=', type2journal.get(type_inv, 'sale'))) + res = journal_obj.search(cr, uid, domain, limit=1) return res and res[0] or False def _get_currency(self, cr, uid, context=None):