Skip to content

Commit

Permalink
fix: bom creator not able to amend / duplicate (#38128)
Browse files Browse the repository at this point in the history
fix: bom creator not able to amend
  • Loading branch information
rohitwaghchaure committed Nov 16, 2023
1 parent 5cc8603 commit 2df767f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion erpnext/manufacturing/doctype/bom_creator/bom_creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ frappe.ui.form.on("BOM Creator", {
|| frappe.bom_configurator.bom_configurator !== frm.doc.name)) {
frm.trigger("build_tree");
}
} else {
} else if (!frm.doc.items?.length ) {
let $parent = $(frm.fields_dict["bom_creator"].wrapper);
$parent.empty();
frm.trigger("make_new_entry");
Expand Down
14 changes: 11 additions & 3 deletions erpnext/manufacturing/doctype/bom_creator/bom_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import flt
from frappe.utils import cint, flt

from erpnext.manufacturing.doctype.bom.bom import get_bom_item_rate

Expand Down Expand Up @@ -91,11 +91,19 @@ def set_reference_id(self):
parent_reference = {row.idx: row.name for row in self.items}

for row in self.items:
if row.fg_reference_id:
ref_id = ""

if row.parent_row_no:
ref_id = parent_reference.get(cint(row.parent_row_no))

# Check whether the reference id of the FG Item has correct or not
if row.fg_reference_id and row.fg_reference_id == ref_id:
continue

if row.parent_row_no:
row.fg_reference_id = parent_reference.get(row.parent_row_no)
row.fg_reference_id = ref_id
elif row.fg_item == self.item_code:
row.fg_reference_id = self.name

@frappe.whitelist()
def add_boms(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@
"fieldname": "parent_row_no",
"fieldtype": "Data",
"label": "Parent Row No",
"no_copy": 1,
"print_hide": 1
},
{
Expand All @@ -231,7 +230,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-07 11:52:30.492233",
"modified": "2023-11-16 13:34:06.321061",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM Creator Item",
Expand Down

0 comments on commit 2df767f

Please sign in to comment.