Actually, I have a requirement that I want to show the parent BOM in the BOM Doctype, therefore I created a new child doctype name BOM Parent and attached it to BOM.
Now, What I want is when the BOM get loaded it should pull all the parent records of the selected BOM as it shows the child record of the BOM.
JS Code:
frappe.call({
method: "library_management.library_management.paste_files.get_bom_detail",
//method: "frappe.core.doctype.file.file.create_new_folder",
args: data2,
callback: function(r) {
if(!r.exc && r.message) {
for ( var i=0; i< r.message.length; i++ ) {
var d = frm.add_child("bom_parent");
var item = r.message[i];
for ( var key in item) {
if ( !is_null(item[key]) ) {
d[key] = item[key];
}
}
}
frm.refresh_field("bom_parent");
}
}
})
Python Code:
@frappe.whitelist
def get_bom_detail(item_code):
return frappe.db.sql(“”“select name from tabBOM
where item=%s”“”, item_code, as_dict=1)
Any help in this context will be appreciated.
Edit: I tried using above code but I receive a message “Not Permitted”
Regards
Ruchin Sharma