Modified validation for duplicate item
This commit is contained in:
parent
0900756510
commit
65a053abe6
@ -133,24 +133,13 @@ class DocType(TransactionBase):
|
|||||||
# Does not allow same item code to be entered twice
|
# Does not allow same item code to be entered twice
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
def validate_for_items(self):
|
def validate_for_items(self):
|
||||||
check_list=[]
|
|
||||||
chk_dupl_itm = []
|
chk_dupl_itm = []
|
||||||
for d in getlist(self.doclist,'quotation_details'):
|
for d in getlist(self.doclist,'quotation_details'):
|
||||||
ch = sql("select is_stock_item from `tabItem` where name = '%s'"%d.item_code)
|
if [cstr(d.item_code),cstr(d.description)] in chk_dupl_itm:
|
||||||
if ch and ch[0][0]=='Yes':
|
msgprint("Item %s has been entered twice." % d.item_code)
|
||||||
if cstr(d.item_code) in check_list:
|
raise Exception
|
||||||
msgprint("Item %s has been entered twice." % d.item_code)
|
else:
|
||||||
raise Exception
|
chk_dupl_itm.append(f)
|
||||||
else:
|
|
||||||
check_list.append(cstr(d.item_code))
|
|
||||||
|
|
||||||
if ch and ch[0][0]=='No':
|
|
||||||
f = [cstr(d.item_code),cstr(d.description)]
|
|
||||||
if f in chk_dupl_itm:
|
|
||||||
msgprint("Item %s has been entered twice." % d.item_code)
|
|
||||||
raise Exception
|
|
||||||
else:
|
|
||||||
chk_dupl_itm.append(f)
|
|
||||||
|
|
||||||
|
|
||||||
#do not allow sales item in maintenance quotation and service item in sales quotation
|
#do not allow sales item in maintenance quotation and service item in sales quotation
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user