[FIX] account: avoid tax on name search to execute request with empty journal (if context == {'journal_id': False}) (opw 606875)
bzr revid: mat@openerp.com-20140422135012-6faelx7cf0p8cvab
This commit is contained in:
commit
23268ad677
|
@ -1956,15 +1956,17 @@ class account_tax(osv.osv):
|
|||
return super(account_tax, self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
|
||||
if context is None:
|
||||
context = {}
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
|
||||
if context and context.has_key('type'):
|
||||
if context.get('type'):
|
||||
if context.get('type') in ('out_invoice','out_refund'):
|
||||
args += [('type_tax_use','in',['sale','all'])]
|
||||
elif context.get('type') in ('in_invoice','in_refund'):
|
||||
args += [('type_tax_use','in',['purchase','all'])]
|
||||
|
||||
if context and context.has_key('journal_id'):
|
||||
if context.get('journal_id'):
|
||||
journal = journal_pool.browse(cr, uid, context.get('journal_id'))
|
||||
if journal.type in ('sale', 'purchase'):
|
||||
args += [('type_tax_use','in',[journal.type,'all'])]
|
||||
|
|
Loading…
Reference in New Issue