mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-12 11:25:09 +00:00
(cherry picked from commit ece446ffe5)
Co-authored-by: Alan <2.alan.tom@gmail.com>
This commit is contained in:
@@ -215,7 +215,32 @@ frappe.ui.form.on("BOM", {
|
||||
label: __('Qty To Manufacture'),
|
||||
fieldname: 'qty',
|
||||
reqd: 1,
|
||||
default: 1
|
||||
default: 1,
|
||||
onchange: () => {
|
||||
const { quantity, items: rm } = frm.doc;
|
||||
const variant_items_map = rm.reduce((acc, item) => {
|
||||
acc[item.item_code] = item.qty;
|
||||
return acc;
|
||||
}, {});
|
||||
const mf_qty = cur_dialog.fields_list.filter(
|
||||
(f) => f.df.fieldname === "qty"
|
||||
)[0]?.value;
|
||||
const items = cur_dialog.fields.filter(
|
||||
(f) => f.fieldname === "items"
|
||||
)[0]?.data;
|
||||
|
||||
if (!items) {
|
||||
return;
|
||||
}
|
||||
|
||||
items.forEach((item) => {
|
||||
item.qty =
|
||||
(variant_items_map[item.item_code] * mf_qty) /
|
||||
quantity;
|
||||
});
|
||||
|
||||
cur_dialog.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user