From 65a053abe6b1949f384f2a3b3d4532ee877a99db Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 16 Nov 2011 14:19:26 +0530 Subject: [PATCH] Modified validation for duplicate item --- .../selling/doctype/quotation/quotation.py | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 11755406fa..84c4da1c50 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -133,24 +133,13 @@ class DocType(TransactionBase): # Does not allow same item code to be entered twice # ------------------------------------------------- def validate_for_items(self): - check_list=[] chk_dupl_itm = [] for d in getlist(self.doclist,'quotation_details'): - ch = sql("select is_stock_item from `tabItem` where name = '%s'"%d.item_code) - if ch and ch[0][0]=='Yes': - if cstr(d.item_code) in check_list: - msgprint("Item %s has been entered twice." % d.item_code) - raise Exception - 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) + if [cstr(d.item_code),cstr(d.description)] 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