fix: job card error handling for operations field (#23996)

Co-authored-by: pateljannat <jannatpatel@MacBook-Air.local>
This commit is contained in:
Jannat Patel
2020-11-25 09:07:57 +05:30
committed by GitHub
parent ca05945e92
commit 42b24cc9eb

View File

@@ -224,17 +224,19 @@ def get_operation_details(work_order, operation):
@frappe.whitelist()
def get_operations(doctype, txt, searchfield, start, page_len, filters):
if filters.get("work_order"):
args = {"parent": filters.get("work_order")}
if txt:
args["operation"] = ("like", "%{0}%".format(txt))
if not filters.get("work_order"):
frappe.msgprint(_("Please select a Work Order first."))
return []
args = {"parent": filters.get("work_order")}
if txt:
args["operation"] = ("like", "%{0}%".format(txt))
return frappe.get_all("Work Order Operation",
filters = args,
fields = ["distinct operation as operation"],
limit_start = start,
limit_page_length = page_len,
order_by="idx asc", as_list=1)
return frappe.get_all("Work Order Operation",
filters = args,
fields = ["distinct operation as operation"],
limit_start = start,
limit_page_length = page_len,
order_by="idx asc", as_list=1)
@frappe.whitelist()
def make_material_request(source_name, target_doc=None):