From 5ff03e460b4df2fb744c7f5b3cdbeb26cbb83774 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 2 Dec 2013 15:27:13 +0530 Subject: [PATCH] [fix] [minor] removed duplicate validation for sales bom --- selling/doctype/sales_bom/sales_bom.py | 38 -------------------------- 1 file changed, 38 deletions(-) diff --git a/selling/doctype/sales_bom/sales_bom.py b/selling/doctype/sales_bom/sales_bom.py index f2b00c6007..f6cfafa41d 100644 --- a/selling/doctype/sales_bom/sales_bom.py +++ b/selling/doctype/sales_bom/sales_bom.py @@ -3,8 +3,6 @@ from __future__ import unicode_literals import webnotes -from webnotes.utils import flt -from webnotes.model.utils import getlist class DocType: def __init__(self,d,dl): @@ -14,8 +12,6 @@ class DocType: self.doc.name = self.doc.new_item_code def validate(self): - # check for duplicate - self.check_duplicate() self.validate_main_item() from utilities.transaction_base import validate_uom_is_integer @@ -36,40 +32,6 @@ class DocType: 'uom': det and det[0][1] or '' } - def check_duplicate(self, finder=0): - il = getlist(self.doclist, "sales_bom_items") - if not il: - webnotes.msgprint("Add atleast one item") - return - - # get all Sales BOM that have the first item - sbl = webnotes.conn.sql("""select distinct parent from `tabSales BOM Item` where item_code=%s - and parent != %s and docstatus != 2""", (il[0].item_code, self.doc.name)) - - # check all siblings - sub_items = [[d.item_code, flt(d.qty)] for d in il] - - for s in sbl: - t = webnotes.conn.sql("""select item_code, qty from `tabSales BOM Item` where parent=%s and - docstatus != 2""", s[0]) - t = [[d[0], flt(d[1])] for d in t] - - if self.has_same_items(sub_items, t): - webnotes.msgprint("%s has the same Sales BOM details" % s[0]) - raise Exception - if finder: - webnotes.msgprint("There is no Sales BOM present with the following Combination.") - - def has_same_items(self, l1, l2): - if len(l1)!=len(l2): return 0 - for l in l2: - if l not in l1: - return 0 - for l in l1: - if l not in l2: - return 0 - return 1 - def get_new_item_code(doctype, txt, searchfield, start, page_len, filters): from controllers.queries import get_match_cond