fix: don't allow to update Maintain Stock
if the item has a BOM
This commit is contained in:
parent
f04ae7a112
commit
6d0842465b
@ -937,17 +937,21 @@ class Item(Document):
|
||||
"Purchase Order Item",
|
||||
"Material Request Item",
|
||||
"Product Bundle",
|
||||
"BOM",
|
||||
]
|
||||
|
||||
for doctype in linked_doctypes:
|
||||
filters = {"item_code": self.name, "docstatus": 1}
|
||||
|
||||
if doctype == "Product Bundle":
|
||||
filters = {"new_item_code": self.name}
|
||||
if doctype in ("Product Bundle", "BOM"):
|
||||
if doctype == "Product Bundle":
|
||||
filters = {"new_item_code": self.name}
|
||||
fieldname = "new_item_code as docname"
|
||||
else:
|
||||
filters = {"item": self.name, "docstatus": 1}
|
||||
fieldname = "name as docname"
|
||||
|
||||
if linked_doc := frappe.db.get_value(
|
||||
doctype, filters, ["new_item_code as docname"], as_dict=True
|
||||
):
|
||||
if linked_doc := frappe.db.get_value(doctype, filters, fieldname, as_dict=True):
|
||||
return linked_doc.update({"doctype": doctype})
|
||||
|
||||
elif doctype in (
|
||||
|
Loading…
x
Reference in New Issue
Block a user