[FIX] account: set correct journal while opening customer and supplier invoices and refunds

bzr revid: mra@tinyerp.com-20100122110653-lck2y7wkk5b8yyu7
This commit is contained in:
mra (Open ERP) 2010-01-22 16:36:53 +05:30
parent 22f41a324c
commit 7681deb834
1 changed files with 2 additions and 1 deletions

View File

@ -63,8 +63,9 @@ class account_invoice(osv.osv):
context = {}
type_inv = context.get('type', 'out_invoice')
type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale', 'in_refund': 'purchase'}
refund_journal = {'out_invoice': False, 'in_invoice': False, 'out_refund': True, 'in_refund': True}
journal_obj = self.pool.get('account.journal')
res = journal_obj.search(cr, uid, [('type', '=', type2journal.get(type_inv, 'sale'))], limit=1)
res = journal_obj.search(cr, uid, [('type', '=', type2journal.get(type_inv, 'sale')), ('refund_journal', '=', refund_journal.get(type_inv, False))], limit=1)
if res:
return res[0]
else: