From 84b40e34eb339c20f8516f29758d2b1f929a1a6b Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 28 May 2012 13:25:41 +0530 Subject: [PATCH] fix: auto set insert after of custom fields on load, if previously specified --- js/wn/router.js | 2 +- py/core/doctype/custom_field/custom_field.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/js/wn/router.js b/js/wn/router.js index 3b45c86b9c..f4708b1626 100644 --- a/js/wn/router.js +++ b/js/wn/router.js @@ -42,7 +42,7 @@ wn.get_route = function(route) { // for app return $.map(wn.get_route_str(route).split('/'), - function(r) { return decodeURIComponent(r); }); + function(r) { return decodeURIComponent(r); }); } wn.get_route_str = function(route) { diff --git a/py/core/doctype/custom_field/custom_field.js b/py/core/doctype/custom_field/custom_field.js index a790e03454..7d5c2d38f4 100644 --- a/py/core/doctype/custom_field/custom_field.js +++ b/py/core/doctype/custom_field/custom_field.js @@ -75,7 +75,12 @@ cur_frm.cscript.dt = function(doc, dt, dn) { method: 'core.doctype.custom_field.custom_field.get_fields_label', args: { doctype: doc.dt, fieldname: doc.fieldname }, callback: function(r, rt) { - set_field_options('insert_after', r.message); + doc = locals[doc.doctype][doc.name]; + var insert_after_val = null; + if(doc.insert_after) { + insert_after_val = doc.insert_after; + } + set_field_options('insert_after', r.message, insert_after_val); } }); }