Przeglądaj źródła

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
version-14
bcornwellmott 8 lat temu
committed by Rushabh Mehta
rodzic
commit
377f233ca4
2 zmienionych plików z 8 dodań i 6 usunięć
  1. +6
    -4
      frappe/public/js/frappe/list/list_renderer.js
  2. +2
    -2
      frappe/public/js/frappe/model/indicator.js

+ 6
- 4
frappe/public/js/frappe/list/list_renderer.js Wyświetl plik

@@ -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);


+ 2
- 2
frappe/public/js/frappe/model/indicator.js Wyświetl plik

@@ -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 = "";


Ładowanie…
Anuluj
Zapisz