From 74bf94d3cebeebbfc1ff820aea41ae43dd3f3135 Mon Sep 17 00:00:00 2001 From: "Hardik Ansodariy (OpenERP)" Date: Thu, 8 Sep 2011 10:21:30 +0530 Subject: [PATCH] [imp] set default journal using existing method bzr revid: han@tinyerp.com-20110908045130-zzd3lx987mqt1mng --- addons/stock/wizard/stock_invoice_onshipping.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/addons/stock/wizard/stock_invoice_onshipping.py b/addons/stock/wizard/stock_invoice_onshipping.py index 4dc037e3879..f94f184ad42 100644 --- a/addons/stock/wizard/stock_invoice_onshipping.py +++ b/addons/stock/wizard/stock_invoice_onshipping.py @@ -26,22 +26,7 @@ from tools.translate import _ class stock_invoice_onshipping(osv.osv_memory): def _get_journal(self, cr, uid, context=None): - if context is None: - context = {} - stock = self.pool.get('stock.picking') - stock_browse = stock.browse(cr, uid, context.get('active_id')) - if stock_browse.type == 'out': - type_inv = 'out' - elif stock_browse.type == 'in': - type_inv = 'in' - user = self.pool.get('res.users').browse(cr, uid, uid, context=context) - company_id = context.get('company_id', user.company_id.id) - type2journal = {'out': 'sale', 'in': 'purchase'} - journal_obj = self.pool.get('account.journal') - res = journal_obj.search(cr, uid, [('type', '=', type2journal.get(type_inv)), - ('company_id', '=', company_id)], - limit=1) - return res and res[0] or False + return self._get_journal_id(cr, uid, context=context)[0][0] or False def _get_journal_id(self, cr, uid, context=None): if context is None: