diff --git a/webnotes/__init__.py b/webnotes/__init__.py index 97cd0fae71..09f9aa9da2 100644 --- a/webnotes/__init__.py +++ b/webnotes/__init__.py @@ -102,6 +102,7 @@ def init(site, sites_path=None): local.rollback_observers = [] local.module_app = None local.app_modules = None + local.user = None setup_module_map() @@ -263,8 +264,10 @@ def clear_cache(user=None, doctype=None): def get_roles(username=None): import webnotes.profile - if not username or username==session.user: - return user.get_roles() + if not local.session: + return ["Guest"] + elif not username or username==local.session.user: + return local.user.get_roles() else: return webnotes.profile.Profile(username).get_roles() diff --git a/webnotes/core/page/applications/applications.js b/webnotes/core/page/applications/applications.js index 2515f9a272..41d991d1ae 100644 --- a/webnotes/core/page/applications/applications.js +++ b/webnotes/core/page/applications/applications.js @@ -52,7 +52,7 @@ wn.pages['applications'].onload = function(wrapper) { if(!r.exc) { msgprint(" Installed"); msgprint("Refreshing..."); - setTimeout(2000, window.location.reload) + setTimeout(window.location.reload, 2000) } } }) diff --git a/webnotes/public/js/legacy/form.js b/webnotes/public/js/legacy/form.js index 2d76628288..bdceb9bf7b 100644 --- a/webnotes/public/js/legacy/form.js +++ b/webnotes/public/js/legacy/form.js @@ -432,7 +432,7 @@ _f.Frm.prototype.refresh_field = function(fname) { } _f.Frm.prototype.refresh_fields = function() { - this.layout.refresh(); + this.layout.refresh(this.doc); this.layout.primary_button = $(this.wrapper).find(".btn-primary"); // cleanup activities after refresh @@ -634,7 +634,7 @@ _f.Frm.prototype.save = function(save_action, callback, btn, on_error) { $(document.activeElement).blur(); // let any pending js process finish - setTimeout(10, this._save(save_action, callback, btn, on_error)); + setTimeout(100, this._save(save_action, callback, btn, on_error)); } _f.Frm.prototype._save = function(save_action, callback, btn, on_error) { diff --git a/webnotes/public/js/wn/form/control.js b/webnotes/public/js/wn/form/control.js index 21d5453d21..df46570d12 100644 --- a/webnotes/public/js/wn/form/control.js +++ b/webnotes/public/js/wn/form/control.js @@ -187,7 +187,7 @@ wn.ui.form.ControlInput = wn.ui.form.Control.extend({ if(me.doctype && me.docname) { me.value = wn.model.get_value(me.doctype, me.docname, me.df.fieldname); } - + if(me.disp_status=="Write") { me.disp_area && $(me.disp_area).toggle(false); $(me.input_area).toggle(true); diff --git a/webnotes/public/js/wn/form/grid.js b/webnotes/public/js/wn/form/grid.js index 0966dc9369..c93079ad52 100644 --- a/webnotes/public/js/wn/form/grid.js +++ b/webnotes/public/js/wn/form/grid.js @@ -229,9 +229,7 @@ wn.ui.form.GridRow = Class.extend({ // refersh form fields if(this.show) { - $.each(this.fields, function(i, f) { - f.refresh(); - }); + this.layout.refresh(this.doc); } }, make_static_display: function() { @@ -400,54 +398,67 @@ wn.ui.form.GridRow = Class.extend({ this.make_form(); this.form_area.empty(); - var me = this, - make_row = function(label) { - if(label) - $('