From cbefeee47dc16c1892af6dc1dab536345b1f5ee4 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 9 Jan 2013 19:39:02 +0530 Subject: [PATCH] workflow updates: added workflow state to standard print format --- core/doctype/customize_form/customize_form.py | 1 + public/js/legacy/widgets/form/fields.js | 4 ++-- public/js/legacy/widgets/form/form.js | 3 ++- public/js/legacy/widgets/form/print_format.js | 8 ++++++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/core/doctype/customize_form/customize_form.py b/core/doctype/customize_form/customize_form.py index 01fd4a48a5..527d08e134 100644 --- a/core/doctype/customize_form/customize_form.py +++ b/core/doctype/customize_form/customize_form.py @@ -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): diff --git a/public/js/legacy/widgets/form/fields.js b/public/js/legacy/widgets/form/fields.js index 953fe2b981..a4a0dbdc97 100644 --- a/public/js/legacy/widgets/form/fields.js +++ b/public/js/legacy/widgets/form/fields.js @@ -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'; } } diff --git a/public/js/legacy/widgets/form/form.js b/public/js/legacy/widgets/form/form.js index c20f3e624e..8c3ac5aefb 100644 --- a/public/js/legacy/widgets/form/form.js +++ b/public/js/legacy/widgets/form/form.js @@ -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; diff --git a/public/js/legacy/widgets/form/print_format.js b/public/js/legacy/widgets/form/print_format.js index 8cbc95a155..a8c796cd0f 100644 --- a/public/js/legacy/widgets/form/print_format.js +++ b/public/js/legacy/widgets/form/print_format.js @@ -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) {