Allow workflow state and status in listview (#3757)
* Allow workflow state and status in listview * Clear trailing blankspace * Fixed bug when missing override_status * Commonized duplicate code
This commit is contained in:
parent
25dcdd2462
commit
377f233ca4
2 changed files with 8 additions and 6 deletions
|
|
@ -405,7 +405,7 @@ frappe.views.ListRenderer = Class.extend({
|
|||
},
|
||||
|
||||
get_indicator_html: function (doc) {
|
||||
var indicator = frappe.get_indicator(doc, this.doctype);
|
||||
var indicator = this.get_indicator_from_doc(doc);
|
||||
if (indicator) {
|
||||
return `<span class='indicator ${indicator[1]} filterable'
|
||||
data-filter='${indicator[2]}'>
|
||||
|
|
@ -414,15 +414,17 @@ frappe.views.ListRenderer = Class.extend({
|
|||
}
|
||||
return '';
|
||||
},
|
||||
|
||||
get_indicator_dot: function (doc) {
|
||||
var indicator = frappe.get_indicator(doc, this.doctype);
|
||||
var indicator = this.get_indicator_from_doc(doc);
|
||||
if (!indicator) {
|
||||
return '';
|
||||
}
|
||||
return `<span class='indicator ${indicator[1]}' title='${__(indicator[0])}'></span>`;
|
||||
},
|
||||
|
||||
get_indicator_from_doc: function (doc) {
|
||||
var workflow = frappe.workflow.workflows[this.doctype];
|
||||
return frappe.get_indicator(doc, this.doctype, (workflow && workflow['override_status']) || true);
|
||||
},
|
||||
prepare_data: function (data) {
|
||||
if (data.modified)
|
||||
this.prepare_when(data, data.modified);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ frappe.has_indicator = function(doctype) {
|
|||
return false;
|
||||
}
|
||||
|
||||
frappe.get_indicator = function(doc, doctype) {
|
||||
frappe.get_indicator = function(doc, doctype, without_workflow = true) {
|
||||
if(doc.__unsaved) {
|
||||
return [__("Not Saved"), "orange"];
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ frappe.get_indicator = function(doc, doctype) {
|
|||
workflow_fieldname = frappe.workflow.get_state_fieldname(doctype);
|
||||
|
||||
// workflow
|
||||
if(workflow_fieldname) {
|
||||
if(workflow_fieldname && !without_workflow) {
|
||||
var value = doc[workflow_fieldname];
|
||||
if(value) {
|
||||
var colour = "";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue