feat: validate linked sales order on material request creation
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 95578cb..ea18004 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -261,7 +261,7 @@
for d in self.get("items"):
if d.get(ref_fieldname):
status = frappe.db.get_value("Sales Order", d.get(ref_fieldname), "status")
- if status == "Closed" or status == "On Hold":
+ if status in ("Closed", "On Hold"):
frappe.throw(_("Sales Order {0} is {1}").format(d.get(ref_fieldname), status))
def update_reserved_qty(self):
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index f0723b6..2735f37 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -128,7 +128,7 @@
},
get_query_filters: {
docstatus: 1,
- status: ["!=", "Closed"],
+ status: ["not in", ["Closed", "On Hold"]],
per_delivered: ["<", 99.99],
}
});