Udate Item Name and Description in BOM and BOM Item

Hi Everyone
Can anyone tell me how to use child table fields in cur_frm.add_fetch

frappe.ui.form.on("BOM", "onload", function(frm) {
                cur_frm.add_fetch("item_code", "item_name", "item_name");
		cur_frm.add_fetch("item_code", "description", "description");
		
});
frappe.ui.form.on("BOM Item", "onload", function(frm) {
                cur_frm.add_fetch("item_code", "item_name", "item_name");
		cur_frm.add_fetch("item_code", "description", "description");
		
});

Actually, I want to update the name in BOM and BOM Item whenever an an item name is get changed
Because we have so many freezed BOM’s where few of them needs item name correct
I have tried the both of the above ways but none of the one is working

add_fetch should be outside of any function.
This will work, when you change Item code, item name will be fetched from Item master.
cur_frm.add_fetch("item_code", "item_name", "item_name"); cur_frm.add_fetch("item_code", "description", "description");

@kolate_sambhaji

I have tried this too but not working.

My requirement is when I make changes to the item name/ item description .
When I reload the BOM name and description of the item should change in the BOM and BOM Item.
Remember, in this case I don’t want to reselect the item, BOM can be already submitted.

This functionality is by default working in Item Price but not working in any other Form.

For this, you need to write server side script,
You need to check BOM and update items

@kolate_sambhaji

Please suggest me how?

Regards
Ruchin Sharma

@ruchin78

here is item price code.

You can make white listed method same as above code.

@kolate_sambhaji

Thanks a lot got it now.

Regards
Ruchin Sharma

1 Like