Hi
I am trying to combine “status” and “workflow_state” for Material request and modifying “status” with an indication that reflects both states.
I do find however, that this code only works if “docstatus” = 1
It does not work if “docstatus” = 0,2
frappe.listview_settings['Material Request'] = {
add_fields: ['status', 'workflow_state', 'name'],
get_indicator: function(doc) {
// let combined_state = `${doc.workflow_state} / ${doc.status}`;
let combined_state = '';
let wf_state = '';
if (doc.workflow_state == "Draft") {
wf_state = "Drft";
}
if (doc.workflow_state == "Approved") {
wf_state = "Appd";
}
if (doc.workflow_state == "Approval Pending by Stock Manager") {
wf_state = "App Pend";
}
if (doc.workflow_state == "Cancelled") {
wf_state = "Cancl";
}
let indicator_color = "grey"; // Default color
if (doc.status == "Draft") {
combined_state = wf_state +'/Draft';
indicator_color = "orange";
}
if (doc.status == "Pending") {
combined_state = wf_state +'/Pend';
indicator_color = "blue";
}
if (doc.status == "Manufactured") {
combined_state = wf_state +'/Manuf';
indicator_color = "green";
}
if (doc.status == "Cancelled") {
combined_state = wf_state +'/Cancl';
indicator_color = "orange";
}
return [combined_state, indicator_color];
}
// formatters : {
// workflow_state(val) {
// if (val == "Approved") {
// return 'SUbm';
// }
// }
// }
};
Is there a reason for this ?