fixes
This commit is contained in:
parent
c8c67f7807
commit
acbf185c1e
@ -214,22 +214,14 @@ class BOM(Document):
|
|||||||
frappe.throw(_("Raw Materials cannot be blank."))
|
frappe.throw(_("Raw Materials cannot be blank."))
|
||||||
check_list = []
|
check_list = []
|
||||||
for m in self.get('items'):
|
for m in self.get('items'):
|
||||||
|
|
||||||
if m.bom_no:
|
if m.bom_no:
|
||||||
validate_bom_no(m.item_code, m.bom_no)
|
validate_bom_no(m.item_code, m.bom_no)
|
||||||
|
|
||||||
if flt(m.qty) <= 0:
|
if flt(m.qty) <= 0:
|
||||||
frappe.throw(_("Quantity required for Item {0} in row {1}").format(m.item_code, m.idx))
|
frappe.throw(_("Quantity required for Item {0} in row {1}").format(m.item_code, m.idx))
|
||||||
|
check_list.append(cstr(m.item_code))
|
||||||
self.check_if_item_repeated(m.item_code, check_list)
|
unique_chk_list = set(check_list)
|
||||||
|
if len(unique_chk_list) != len(check_list):
|
||||||
|
frappe.throw(_("Same item has been entered multiple times."))
|
||||||
def check_if_item_repeated(self, item, check_list):
|
|
||||||
|
|
||||||
if [cstr(item)] in check_list:
|
|
||||||
frappe.throw(_("Item {0} has been entered multiple times.").format(item))
|
|
||||||
else:
|
|
||||||
check_list.append([cstr(item)])
|
|
||||||
|
|
||||||
def check_recursion(self):
|
def check_recursion(self):
|
||||||
""" Check whether recursion occurs in any bom"""
|
""" Check whether recursion occurs in any bom"""
|
||||||
|
@ -67,7 +67,6 @@
|
|||||||
],
|
],
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
"operation": 1,
|
|
||||||
"amount": 5000.0,
|
"amount": 5000.0,
|
||||||
"doctype": "BOM Item",
|
"doctype": "BOM Item",
|
||||||
"item_code": "_Test Item",
|
"item_code": "_Test Item",
|
||||||
@ -77,7 +76,6 @@
|
|||||||
"stock_uom": "_Test UOM"
|
"stock_uom": "_Test UOM"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"operation": 1,
|
|
||||||
"amount": 2000.0,
|
"amount": 2000.0,
|
||||||
"bom_no": "BOM/_Test Item Home Desktop Manufactured/001",
|
"bom_no": "BOM/_Test Item Home Desktop Manufactured/001",
|
||||||
"doctype": "BOM Item",
|
"doctype": "BOM Item",
|
||||||
@ -108,7 +106,6 @@
|
|||||||
],
|
],
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
"operation": 1,
|
|
||||||
"amount": 5000.0,
|
"amount": 5000.0,
|
||||||
"doctype": "BOM Item",
|
"doctype": "BOM Item",
|
||||||
"item_code": "_Test Item",
|
"item_code": "_Test Item",
|
||||||
|
Loading…
Reference in New Issue
Block a user