[imp] set default journal using existing method
bzr revid: han@tinyerp.com-20110908045130-zzd3lx987mqt1mng
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user