瀏覽代碼

[fix] document_flow.js

version-14
Rushabh Mehta 9 年之前
父節點
當前提交
4347fac6a1
共有 1 個檔案被更改,包括 15 行新增11 行删除
  1. +15
    -11
      frappe/public/js/frappe/form/document_flow.js

+ 15
- 11
frappe/public/js/frappe/form/document_flow.js 查看文件

@@ -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() {


Loading…
取消
儲存