Browse Source

[hot] more js fixes

version-14
Rushabh Mehta 8 years ago
parent
commit
4a7551a010
2 changed files with 14 additions and 4 deletions
  1. +1
    -1
      frappe/public/js/frappe/form/control.js
  2. +13
    -3
      frappe/public/js/frappe/form/script_manager.js

+ 1
- 1
frappe/public/js/frappe/form/control.js View File

@@ -129,7 +129,7 @@ frappe.ui.form.Control = Class.extend({
}; };


value = this.validate(value); value = this.validate(value);
if (value.then) {
if (value && value.then) {
// got a promise // got a promise
return value.then((value) => set(value)); return value.then((value) => set(value));
} else { } else {


+ 13
- 3
frappe/public/js/frappe/form/script_manager.js View File

@@ -101,11 +101,21 @@ frappe.ui.form.ScriptManager = Class.extend({


// make list of functions to be run serially // make list of functions to be run serially
handlers.new_style.forEach((_function) => { handlers.new_style.forEach((_function) => {
tasks.push(() => runner(_function, false));
if(event_name==='setup') {
// setup must be called immediately
runner(_function, false);
} else {
tasks.push(() => runner(_function, false));
}
}); });


handlers.old_style.forEach((_function) => { handlers.old_style.forEach((_function) => {
tasks.push(() => runner(_function, true));
if(event_name==='setup') {
// setup must be called immediately
runner(_function, false);
} else {
tasks.push(() => runner(_function, true));
}
}); });


// run them serially // run them serially
@@ -147,7 +157,7 @@ frappe.ui.form.ScriptManager = Class.extend({


if(doctype.__custom_js) { if(doctype.__custom_js) {
try { try {
eval(doctype.__custom_js)
eval(doctype.__custom_js);
} catch(e) { } catch(e) {
frappe.msgprint({ frappe.msgprint({
title: __('Error in Custom Script'), title: __('Error in Custom Script'),


Loading…
Cancel
Save