fixes in item: duplicate tax validation

This commit is contained in:
Nabin Hait 2013-02-07 11:36:37 +05:30
parent 7e0b9a4212
commit c39d13b6a7

View File

@ -122,21 +122,20 @@ class DocType:
cust_code.append(d.ref_code) cust_code.append(d.ref_code)
self.doc.customer_code=','.join(cust_code) self.doc.customer_code=','.join(cust_code)
# Check whether Tax Rate is not entered twice for same Tax Type
def check_item_tax(self): def check_item_tax(self):
"""Check whether Tax Rate is not entered twice for same Tax Type"""
check_list=[] check_list=[]
for d in getlist(self.doclist,'item_tax'): for d in getlist(self.doclist,'item_tax'):
account_type = sql("select account_type from tabAccount where name = %s",d.tax_type) if d.tax_type:
account_type = account_type and account_type[0][0] or '' account_type = webnotes.conn.get_value("Account", d.tax_type, "account_type")
if account_type not in ['Tax', 'Chargeable']:
msgprint("'%s' is not Tax / Chargeable Account"%(d.tax_type)) if account_type not in ['Tax', 'Chargeable']:
raise Exception, "Tax Account validation" msgprint("'%s' is not Tax / Chargeable Account" % d.tax_type, raise_exception=1)
else:
if d.tax_type in check_list:
msgprint("Rate is entered twice for Tax : '%s'." % (d.tax_type))
raise Exception
else: else:
check_list.append(d.tax_type) if d.tax_type in check_list:
msgprint("Rate is entered twice for: '%s'" % d.tax_type, raise_exception=1)
else:
check_list.append(d.tax_type)
def check_for_active_boms(self, field_label): def check_for_active_boms(self, field_label):
if field_label in ['Is Active', 'Is Purchase Item']: if field_label in ['Is Active', 'Is Purchase Item']: