Merge pull request #21657 from shariquerik/workflow-state-indicator-fix

This commit is contained in:
Shariq Ansari 2023-07-13 10:49:18 +05:30 committed by GitHub
commit d93bf38251
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -712,9 +712,10 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
get_column_html(col, doc) {
if (col.type === "Status" || col.df?.options == "Workflow State") {
let show_workflow_state = col.df?.options == "Workflow State";
return `
<div class="list-row-col hidden-xs ellipsis">
${this.get_indicator_html(doc)}
${this.get_indicator_html(doc, show_workflow_state)}
</div>
`;
}
@ -1014,8 +1015,8 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
return subject_html;
}
get_indicator_html(doc) {
const indicator = frappe.get_indicator(doc, this.doctype);
get_indicator_html(doc, show_workflow_state) {
const indicator = frappe.get_indicator(doc, this.doctype, show_workflow_state);
// sequence is important
const docstatus_description = [
__("Document is in draft state"),

View file

@ -23,7 +23,7 @@ frappe.has_indicator = function (doctype) {
return false;
};
frappe.get_indicator = function (doc, doctype) {
frappe.get_indicator = function (doc, doctype, show_workflow_state) {
if (doc.__unsaved) {
return [__("Not Saved"), "orange"];
}
@ -40,7 +40,7 @@ frappe.get_indicator = function (doc, doctype) {
workflow_fieldname = frappe.workflow.get_state_fieldname(doctype);
// workflow
if (workflow_fieldname && !without_workflow) {
if (workflow_fieldname && (!without_workflow || show_workflow_state)) {
var value = doc[workflow_fieldname];
if (value) {
var colour = "";