fix: BOM has not attr required items (#44598) (cherry picked from commit42d238da14) Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com> (cherry picked from commit608eaaa482)
This commit is contained in:
@@ -255,12 +255,14 @@ frappe.ui.form.on("BOM", {
|
||||
});
|
||||
}
|
||||
|
||||
fields.push({
|
||||
fieldtype: "Check",
|
||||
label: __("Use Multi-Level BOM"),
|
||||
fieldname: "use_multi_level_bom",
|
||||
default: 1,
|
||||
});
|
||||
if (!skip_qty_field) {
|
||||
fields.push({
|
||||
fieldtype: "Check",
|
||||
label: __("Use Multi-Level BOM"),
|
||||
fieldname: "use_multi_level_bom",
|
||||
default: 1,
|
||||
});
|
||||
}
|
||||
|
||||
if (!skip_qty_field) {
|
||||
fields.push({
|
||||
@@ -306,6 +308,13 @@ frappe.ui.form.on("BOM", {
|
||||
fieldtype: "Link",
|
||||
in_list_view: 1,
|
||||
reqd: 1,
|
||||
get_query() {
|
||||
return {
|
||||
filters: {
|
||||
has_variants: 1,
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldname: "variant_item_code",
|
||||
@@ -326,6 +335,13 @@ frappe.ui.form.on("BOM", {
|
||||
},
|
||||
};
|
||||
},
|
||||
change() {
|
||||
let doc = this.doc;
|
||||
if (!doc.qty) {
|
||||
doc.qty = 1.0;
|
||||
this.grid.set_value("qty", 1.0, doc);
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldname: "qty",
|
||||
|
||||
@@ -1360,7 +1360,9 @@ def add_variant_item(variant_items, wo_doc, bom_no, table_name="items"):
|
||||
args["amount"] = flt(args.get("required_qty")) * flt(args.get("rate"))
|
||||
args["uom"] = item_data.stock_uom
|
||||
|
||||
existing_row = get_template_rm_item(wo_doc, item.get("item_code"))
|
||||
existing_row = (
|
||||
get_template_rm_item(wo_doc, item.get("item_code")) if table_name == "required_items" else None
|
||||
)
|
||||
if existing_row:
|
||||
existing_row.update(args)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user