|
@@ -4,12 +4,24 @@ |
|
|
frappe.ui.form.DocumentFlow = Class.extend({ |
|
|
frappe.ui.form.DocumentFlow = Class.extend({ |
|
|
init: function(opts) { |
|
|
init: function(opts) { |
|
|
$.extend(this, opts); |
|
|
$.extend(this, opts); |
|
|
|
|
|
|
|
|
|
|
|
this.module = frappe.get_meta(this.frm.doctype).module |
|
|
|
|
|
if (!frappe.document_flow[this.module]) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
this.doctypes = frappe.document_flow[this.module][this.frm.doctype]; |
|
|
|
|
|
if (!this.doctypes) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.wrapper = $('<div class="document-flow-wrapper hidden"></div>').prependTo(this.frm.layout.wrapper); |
|
|
this.wrapper = $('<div class="document-flow-wrapper hidden"></div>').prependTo(this.frm.layout.wrapper); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
refresh: function() { |
|
|
refresh: function() { |
|
|
this.reset(); |
|
|
|
|
|
this.render(); |
|
|
|
|
|
|
|
|
if(this.doctypes) { |
|
|
|
|
|
this.reset(); |
|
|
|
|
|
this.render(); |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
reset: function() { |
|
|
reset: function() { |
|
@@ -19,18 +31,10 @@ frappe.ui.form.DocumentFlow = Class.extend({ |
|
|
|
|
|
|
|
|
render: function() { |
|
|
render: function() { |
|
|
var me = this; |
|
|
var me = this; |
|
|
var module = frappe.get_meta(this.frm.doctype).module |
|
|
|
|
|
if (!frappe.document_flow[module]) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
var doctypes = frappe.document_flow[module][this.frm.doctype]; |
|
|
|
|
|
if (!doctypes) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$(frappe.render_template('form_document_flow', { |
|
|
$(frappe.render_template('form_document_flow', { |
|
|
frm: this.frm, |
|
|
frm: this.frm, |
|
|
doctypes: doctypes, |
|
|
|
|
|
|
|
|
doctypes: this.doctypes, |
|
|
})).appendTo(this.wrapper.removeClass('hidden')); |
|
|
})).appendTo(this.wrapper.removeClass('hidden')); |
|
|
|
|
|
|
|
|
this.wrapper.on('click', '.document-flow-link', function() { |
|
|
this.wrapper.on('click', '.document-flow-link', function() { |
|
|