feat: List View indicators for Log and Error Log link in log

This commit is contained in:
marination 2022-03-17 12:58:09 +05:30
parent cff91558d4
commit 8aff75f8e8
3 changed files with 24 additions and 2 deletions

View File

@ -12,6 +12,7 @@
"column_break_3",
"update_type",
"status",
"error_log",
"amended_from"
],
"fields": [
@ -53,13 +54,19 @@
"options": "BOM Update Log",
"print_hide": 1,
"read_only": 1
},
{
"fieldname": "error_log",
"fieldtype": "Link",
"label": "Error Log",
"options": "Error Log"
}
],
"in_create": 1,
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2022-03-17 12:21:16.156437",
"modified": "2022-03-17 12:51:28.067900",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM Update Log",

View File

@ -152,11 +152,13 @@ def run_bom_job(doc: "BOMUpdateLog", boms: Optional[Dict] = None, update_type: O
except (Exception, JobTimeoutException):
frappe.db.rollback()
frappe.log_error(
error_log = frappe.log_error(
message=frappe.get_traceback(),
title=_("BOM Update Tool Error")
)
doc.db_set("status", "Failed")
doc.db_set("error_log", error_log.name)
finally:
frappe.db.auto_commit_on_many_writes = 0

View File

@ -0,0 +1,13 @@
frappe.listview_settings['BOM Update Log'] = {
add_fields: ["status"],
get_indicator: function(doc) {
let status_map = {
"Queued": "orange",
"In Progress": "blue",
"Completed": "green",
"Failed": "red"
}
return [__(doc.status), status_map[doc.status], "status,=," + doc.status];
}
};