fix: bom creator not able to amend / duplicate (backport #38128) (#38129)

fix: bom creator not able to amend / duplicate  (#38128)

fix: bom creator not able to amend
(cherry picked from commit 2df767f596417143ae3b855b2252585bf2bc96f9)

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
mergify[bot] 2023-11-16 18:53:08 +05:30 committed by GitHub
parent d51237195a
commit ed9cd7c92b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 6 deletions

View File

@ -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");

View File

@ -6,7 +6,7 @@ from collections import OrderedDict
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
@ -91,11 +91,19 @@ class BOMCreator(Document):
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):

View File

@ -215,7 +215,6 @@
"fieldname": "parent_row_no",
"fieldtype": "Data",
"label": "Parent Row No",
"no_copy": 1,
"print_hide": 1
},
{
@ -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",