diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index 9fbe4f1174c..3422ba1df7c 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -1012,6 +1012,19 @@ frappe.ui.form.on("BOM Secondary Item", { item_code(frm, cdt, cdn) { const { item_code } = locals[cdt][cdn]; }, + + qty(frm, cdt, cdn) { + const row = locals[cdt][cdn]; + if (flt(row.qty) === 0) { + frappe.show_alert({ + message: __( + "Row #{0}: Qty is set to zero for {1}. The actual output will be entered at the time of manufacture.", + [row.idx, frappe.bold(row.item_code)] + ), + indicator: "blue", + }); + } + }, }); function trigger_process_loss_qty_prompt(frm, cdt, cdn, item_code) { diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index 065707e7e6d..aabfe3c4b7b 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -341,10 +341,15 @@ class BOM(WebsiteGenerator): ).format(item.idx, get_link_to_form("Item", item.item_code)) ) - if not item.qty: + if item.qty is None: frappe.throw( +<<<<<<< HEAD _("Row #{0}: Quantity should be greater than 0 for {1} Item {2}").format( item.idx, item.type, get_link_to_form("Item", item.item_code) +======= + _("Row #{0}: Quantity is required for {1} Item {2}").format( + item.idx, item.secondary_item_type, get_link_to_form("Item", item.item_code) +>>>>>>> 6771daf6a1 (fix(bom): allow zero qty for secondary items (Co-Product, By-Product, Scrap, Additional Finished Good)) ) ) diff --git a/erpnext/manufacturing/doctype/bom_secondary_item/bom_secondary_item.json b/erpnext/manufacturing/doctype/bom_secondary_item/bom_secondary_item.json index 39fa55123f4..819b30ce602 100644 --- a/erpnext/manufacturing/doctype/bom_secondary_item/bom_secondary_item.json +++ b/erpnext/manufacturing/doctype/bom_secondary_item/bom_secondary_item.json @@ -138,8 +138,7 @@ "fieldtype": "Float", "in_list_view": 1, "label": "Qty", - "non_negative": 1, - "reqd": 1 + "non_negative": 1 }, { "default": "0",