[FIX]: fix a problem for the account.move.line filter on sale/purchase tax

bzr revid: mga@tinyerp.com-20100802124955-23mov4lzth15yhx2
This commit is contained in:
Mantavya Gajjar 2010-08-02 18:19:55 +05:30
parent 383f971bde
commit a70befdac7
2 changed files with 7 additions and 3 deletions

View File

@ -1636,7 +1636,6 @@ class account_tax(osv.osv):
@return: Returns a list of tupples containing id and name
"""
if not args:
args=[]
if not context:
@ -1646,6 +1645,8 @@ class account_tax(osv.osv):
return self.name_get(cr, user, ids, context=context)
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
journal_pool = self.pool.get('account.journal')
if context and context.has_key('type'):
if context.get('type') in ('out_invoice','out_refund'):
args += [('type_tax_use','in',['sale','all'])]
@ -1653,7 +1654,9 @@ class account_tax(osv.osv):
args += [('type_tax_use','in',['purchase','all'])]
if context and context.has_key('journal_id'):
args += [('type_tax_use','in',[context.get('journal_id'),'all'])]
journal = journal_pool.browse(cr, uid, context.get('journal_id'))
if journal.type in ('sale', 'purchase'):
args += [('type_tax_use','in',[journal.type,'all'])]
return super(account_tax, self).search(cr, uid, args, offset, limit, order, context, count)

View File

@ -874,12 +874,13 @@ class account_move_line(osv.osv):
attrs.append('sum="Total credit"')
elif field == 'account_tax_id':
attrs.append('domain="[(\'parent_id\',\'=\',False)]"')
attrs.append("context=\"{'journal_id':journal_id}\"")
elif field == 'account_id' and journal.id:
attrs.append('domain="[(\'journal_id\', \'=\', '+str(journal.id)+'),(\'type\',\'<>\',\'view\'), (\'type\',\'<>\',\'closed\')]" on_change="onchange_account_id(account_id, partner_id)"')
elif field == 'partner_id':
attrs.append('on_change="onchange_partner_id(move_id, partner_id, account_id, debit, credit, date, journal_id)"')
elif field == 'journal_id':
attrs.append("context=\"{'journal_id':journal_id.type}\"")
attrs.append("context=\"{'journal_id':journal_id}\"")
if field in ('amount_currency','currency_id'):
attrs.append('on_change="onchange_currency(account_id, amount_currency,currency_id, date, journal_id)"')