mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-18 12:39:18 +00:00
Merge pull request #50913 from rohitwaghchaure/fixed-github-46923
fix: variant items not fetched while making BOM for Variant Item
This commit is contained in:
@@ -460,10 +460,12 @@ frappe.ui.form.on("BOM", {
|
|||||||
);
|
);
|
||||||
|
|
||||||
has_template_rm.forEach((d) => {
|
has_template_rm.forEach((d) => {
|
||||||
|
let bom_qty = dialog.fields_dict.qty?.value || 1;
|
||||||
|
|
||||||
dialog.fields_dict.items.df.data.push({
|
dialog.fields_dict.items.df.data.push({
|
||||||
item_code: d.item_code,
|
item_code: d.item_code,
|
||||||
variant_item_code: "",
|
variant_item_code: "",
|
||||||
qty: (d.qty / frm.doc.quantity) * (dialog.fields_dict.qty.value || 1),
|
qty: flt(d.qty / frm.doc.quantity) * flt(bom_qty),
|
||||||
source_warehouse: d.source_warehouse,
|
source_warehouse: d.source_warehouse,
|
||||||
operation: d.operation,
|
operation: d.operation,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2177,6 +2177,13 @@ def make_work_order(bom_no, item, qty=0, project=None, variant_items=None, use_m
|
|||||||
|
|
||||||
item_details = get_item_details(item, project)
|
item_details = get_item_details(item, project)
|
||||||
|
|
||||||
|
if frappe.db.get_value("Item", item, "variant_of"):
|
||||||
|
if variant_bom := frappe.db.get_value(
|
||||||
|
"BOM",
|
||||||
|
{"item": item, "is_default": 1, "docstatus": 1},
|
||||||
|
):
|
||||||
|
bom_no = variant_bom
|
||||||
|
|
||||||
wo_doc = frappe.new_doc("Work Order")
|
wo_doc = frappe.new_doc("Work Order")
|
||||||
wo_doc.track_semi_finished_goods = frappe.db.get_value("BOM", bom_no, "track_semi_finished_goods")
|
wo_doc.track_semi_finished_goods = frappe.db.get_value("BOM", bom_no, "track_semi_finished_goods")
|
||||||
wo_doc.production_item = item
|
wo_doc.production_item = item
|
||||||
|
|||||||
Reference in New Issue
Block a user