diff --git a/core/doctype/customize_form/customize_form.py b/core/doctype/customize_form/customize_form.py index 1a6daead69..32d251ed75 100644 --- a/core/doctype/customize_form/customize_form.py +++ b/core/doctype/customize_form/customize_form.py @@ -78,7 +78,8 @@ class DocType: for d in self.get_ref_doclist(): if d.doctype=='DocField': - new = addchild(self.doc, 'fields', 'Customize Form Field', 1, self.doclist) + new = addchild(self.doc, 'fields', 'Customize Form Field', + self.doclist) self.set( { 'list': self.docfield_properties, diff --git a/core/doctype/doctype/doctype.py b/core/doctype/doctype/doctype.py index 9626698e3f..9e7629f544 100644 --- a/core/doctype/doctype/doctype.py +++ b/core/doctype/doctype/doctype.py @@ -126,7 +126,7 @@ class DocType: temp_doclist = webnotes.model.doctype.get(self.doc.name) if 'file_list' not in [d.fieldname for d in temp_doclist if \ d.doctype=='DocField']: - new = self.doc.addchild('fields', 'DocField', 1, self.doclist) + new = self.doc.addchild('fields', 'DocField', self.doclist) new.label = 'File List' new.fieldtype = 'Text' new.fieldname = 'file_list' @@ -151,7 +151,7 @@ class DocType: max_idx = max_idx and max_idx or 0 if 'amended_from' not in [d.fieldname for d in temp_doclist if \ d.doctype=='DocField']: - new = self.doc.addchild('fields', 'DocField', 1, self.doclist) + new = self.doc.addchild('fields', 'DocField', self.doclist) new.label = 'Amended From' new.fieldtype = 'Link' new.fieldname = 'amended_from' diff --git a/core/doctype/doctype_mapper/doctype_mapper.py b/core/doctype/doctype_mapper/doctype_mapper.py index ba716e3c66..6d56ab47d6 100644 --- a/core/doctype/doctype_mapper/doctype_mapper.py +++ b/core/doctype/doctype_mapper/doctype_mapper.py @@ -97,7 +97,7 @@ class DocType: # Add a row in target table in 'To DocType' and returns obj if t['to_table'] != self.doc.to_doctype: - to_doc_obj = addchild(to_doc, t['to_field'], t['to_table'], 1, doclist) + to_doc_obj = addchild(to_doc, t['to_field'], t['to_table'], doclist) else: to_doc_obj = to_doc diff --git a/public/js/legacy/widgets/form/form.js b/public/js/legacy/widgets/form/form.js index 041a97578f..80b09efae1 100644 --- a/public/js/legacy/widgets/form/form.js +++ b/public/js/legacy/widgets/form/form.js @@ -919,6 +919,9 @@ _f.Frm.prototype.save = function(save_action, callback, btn) { doclist.save(save_action || "Save", function(r) { if(!r.exc) { me.refresh(); + if(save_action==="Save") { + me.runclientscript("after_save", me.doctype, me.docname); + } } callback && callback(r); }, btn); @@ -944,8 +947,8 @@ _f.Frm.prototype.savecancel = function(btn) { doclist.cancel(function(r) { if(!r.exc) { me.refresh(); + me.runclientscript("after_cancel", me.doctype, me.docname); } - me.runclientscript("after_cancel", me.doctype, me.docname); }, btn); }); } diff --git a/public/js/legacy/widgets/form/form_grid.js b/public/js/legacy/widgets/form/form_grid.js index 64811e6cee..7efee2568a 100644 --- a/public/js/legacy/widgets/form/form_grid.js +++ b/public/js/legacy/widgets/form/form_grid.js @@ -83,21 +83,23 @@ _f.FormGrid.prototype.make_tbar_link = function(parent, label, fn, icon) { } _f.FormGrid.prototype.make_columns = function() { - var gl = wn.meta.docfield_list[this.field.df.options]; - - if(!gl) { - alert('Table details not found "'+this.field.df.options+'"'); - } - - gl.sort(function(a,b) { return a.idx - b.idx}); - var p = this.field.perm; - for(var i=0;i