[FIX] Account: account tax -> correct attrs and put the 0 if the type is none or python code

bzr revid: mra@mra-laptop-20100923103445-88r6hax8nd6beg60
This commit is contained in:
Mustufa Rangwala 2010-09-23 16:04:45 +05:30
parent 907c117027
commit 27ca1f1ea1
2 changed files with 6 additions and 1 deletions

View File

@ -1701,6 +1701,11 @@ class account_tax(osv.osv):
ids = self.search(cr, user, args, limit=limit, context=context)
return self.name_get(cr, user, ids, context=context)
def write(self, cr, uid, ids, vals, context=None):
if vals.get('type', False) and vals['type'] in ('none', 'code'):
vals.update({'amount': 0.0})
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):
journal_pool = self.pool.get('account.journal')

View File

@ -849,7 +849,7 @@
<notebook colspan="4">
<page string="Tax Definition">
<field name="applicable_type"/>
<field name="amount" attrs="{'readonly':[('type','=','none'),('type','=','code')]}"/>
<field name="amount" attrs="{'readonly':[('type','in',('none', 'code'))]}"/>
<field groups="base.group_extended" name="include_base_amount"/>
<field groups="base.group_extended" name="domain"/>
<newline/>