From 27b63beb18c4a67a8043d8cfd5c0635427b47cec Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 21:50:49 +0530 Subject: [PATCH] fix: BOM name issue (backport #44575) (#44579) fix: BOM name issue (#44575) fix: bom name issue (cherry picked from commit b7a3c6b6ca902138007daff2343abe14f91157f7) Co-authored-by: rohitwaghchaure (cherry picked from commit 03ae9e27be5acca32d3e15f8434a3f6062dc8c30) --- erpnext/manufacturing/doctype/bom/bom.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index c3105b8e9ec..f8523c88933 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -176,9 +176,14 @@ class BOM(WebsiteGenerator): search_key = f"{self.doctype}-{self.item}%" existing_boms = frappe.get_all( - "BOM", filters={"name": ("like", search_key), "amended_from": ["is", "not set"]}, pluck="name" + "BOM", filters={"name": search_key, "amended_from": ["is", "not set"]}, pluck="name" ) + if not existing_boms: + existing_boms = frappe.get_all( + "BOM", filters={"name": ("like", search_key), "amended_from": ["is", "not set"]}, pluck="name" + ) + if existing_boms: index = self.get_next_version_index(existing_boms) else: