workflow updates: added workflow state to standard print format

This commit is contained in:
Rushabh Mehta 2013-01-09 19:39:02 +05:30
parent 3a337ac242
commit cbefeee47d
4 changed files with 13 additions and 3 deletions

View file

@ -161,6 +161,7 @@ class DocType:
validate_fields_for_doctype(self.doc.doc_type)
webnotes.clear_cache(doctype=self.doc.doc_type)
webnotes.msgprint("Updated")
def diff(self, new_dl, ref_dl, dt_dl):

View file

@ -177,13 +177,13 @@ Field.prototype.get_status = function() {
}
// workflow state
if(ret=="Write" && cur_frm && cur_frm.states.state_fieldname) {
if(ret=="Write" && cur_frm && cur_frm.state_fieldname) {
if(cur_frm.read_only) {
ret = 'Read';
}
// fields updated by workflow must be read-only
if(in_list(cur_frm.states.update_fields, this.df.fieldname) ||
this.df.fieldname==cur_frm.states.state_fieldname) {
this.df.fieldname==cur_frm.state_fieldname) {
ret = 'Read';
}
}

View file

@ -103,7 +103,8 @@ _f.Frm.prototype.setup = function() {
var me = this;
this.fields = [];
this.fields_dict = {};
this.state_fieldname = wn.workflow.get_state_fieldname(this.doctype);
// wrapper
this.wrapper = this.parent;

View file

@ -466,6 +466,14 @@ $.extend(_p, {
}
var h2 = $a(me.layout.cur_row.header, 'div', '', h2_style);
h2.innerHTML = docname;
if(cur_frm.state_fieldname) {
$a(h2, 'br');
var span = $a(h2, 'span', '',
{padding: "3px", color: "#fff", backgroundColor: "#777",
display:"inline-block"});
span.innerHTML = cur_frm.doc[cur_frm.state_fieldname];
}
},
build_data: function(data, doctype, docname) {