diff --git a/public/css/legacy/body.css b/public/css/legacy/body.css index 366e0703d9..afeadce9e1 100644 --- a/public/css/legacy/body.css +++ b/public/css/legacy/body.css @@ -8,9 +8,6 @@ body { padding: 0px; font-size: 14px; color: #000; -} - -body { background-color: #eee; } diff --git a/public/css/legacy/fields.css b/public/css/legacy/fields.css index 65cc8b1364..021c47a80e 100644 --- a/public/css/legacy/fields.css +++ b/public/css/legacy/fields.css @@ -50,6 +50,7 @@ background-color: #eee; padding: 2px; border: 1px solid #ddd; + margin-bottom: 7px; -webkit-border-radius: 3px; -moz-border-radius: 3px; diff --git a/public/js/legacy/widgets/form/form_header.js b/public/js/legacy/widgets/form/form_header.js index 28179850fa..6bb967749a 100644 --- a/public/js/legacy/widgets/form/form_header.js +++ b/public/js/legacy/widgets/form/form_header.js @@ -104,10 +104,11 @@ _f.FrmHeader = Class.extend({ this.set_label(labinfo); // show update button if unsaved - if(cur_frm.doc.__unsaved && cint(cur_frm.doc.docstatus)==1 && this.appframe.buttons['Update']) { - this.appframe.buttons['Update'].toggle(true); + if(cur_frm.doc.__unsaved && cint(cur_frm.doc.docstatus)==1 && cur_frm.perm[0][SUBMIT]) { + this.appframe.add_button('Update', function() { + cur_frm.save('Update', null, this); + }, '') } - }, set_label: function(labinfo) { this.$w.find('.label').remove(); @@ -148,34 +149,23 @@ _f.FrmHeader = Class.extend({ this.appframe.buttons['Save'].addClass('btn-info') .html(" Save (Ctrl+S)"); } - // Submit - if(docstatus==0 && p[SUBMIT] && (!cur_frm.doc.__islocal)) - this.appframe.add_button('Submit', function() { - cur_frm.savesubmit(this);}, 'icon-lock'); - - // Update after sumit - if(docstatus==1 && p[SUBMIT]) { - this.appframe.add_button('Update', function() { - cur_frm.save('Update', null, this); - }, '').toggle(false); - } - // Cancel - if(docstatus==1 && p[CANCEL]) - this.appframe.add_button('Cancel', function() { - cur_frm.savecancel(this) }, 'icon-remove'); + // Submit + if(!wn.model.get("Workflow", {document_type: cur_frm.doctype}).length) { + if(docstatus==0 && p[SUBMIT] && (!cur_frm.doc.__islocal)) + this.appframe.add_button('Submit', function() { + cur_frm.savesubmit(this);}, 'icon-lock'); - // Amend - if(docstatus==2 && p[AMEND]) - this.appframe.add_button('Amend', function() { - cur_frm.amend_doc() }, 'icon-pencil'); - - // Help - // if(cur_frm.meta.description) { - // this.appframe.add_help_button(wn.markdown('#### ' + cur_frm.doctype + '\n\n' - // + cur_frm.meta.description)); - // } + // Cancel + if(docstatus==1 && p[CANCEL]) + this.appframe.add_button('Cancel', function() { + cur_frm.savecancel(this) }, 'icon-remove'); + // Amend + if(docstatus==2 && p[AMEND]) + this.appframe.add_button('Amend', function() { + cur_frm.amend_doc() }, 'icon-pencil'); + } }, show: function() { }, diff --git a/public/js/wn/form/formatters.js b/public/js/wn/form/formatters.js index 5ca0e3f623..b8c3f7435d 100644 --- a/public/js/wn/form/formatters.js +++ b/public/js/wn/form/formatters.js @@ -64,7 +64,7 @@ wn.form.formatters = { return wn.form.formatters.Text(value); }, WorkflowState: function(value) { - workflow_state = wn.meta.get("Workflow State", value)[0]; + workflow_state = wn.model.get("Workflow State", value)[0]; if(workflow_state) { return repl("