Browse Source

Merge pull request #13306 from surajshetty3416/fix-script-manager

fix: Use extend_cscript in make to properly extend functions of class
version-14
Suraj Shetty 4 years ago
committed by GitHub
parent
commit
d6f8fc7429
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions
  1. +2
    -1
      .eslintrc
  2. +2
    -1
      frappe/public/js/frappe/form/script_manager.js

+ 2
- 1
.eslintrc View File

@@ -149,6 +149,7 @@
"before": true, "before": true,
"beforeEach": true, "beforeEach": true,
"qz": true, "qz": true,
"localforage": true
"localforage": true,
"extend_cscript": true
} }
} }

+ 2
- 1
frappe/public/js/frappe/form/script_manager.js View File

@@ -8,6 +8,7 @@ window.extend_cscript = (cscript, controller_object) => {
if (cscript && controller_object) { if (cscript && controller_object) {
cscript.__proto__ = controller_object.__proto__; cscript.__proto__ = controller_object.__proto__;
} }
return cscript;
}; };


frappe.ui.form.get_event_handler_list = function(doctype, fieldname) { frappe.ui.form.get_event_handler_list = function(doctype, fieldname) {
@@ -81,7 +82,7 @@ frappe.ui.form.ScriptManager = class ScriptManager {
$.extend(this, opts); $.extend(this, opts);
} }
make(ControllerClass) { make(ControllerClass) {
this.frm.cscript = $.extend(this.frm.cscript,
this.frm.cscript = extend_cscript(this.frm.cscript,
new ControllerClass({frm: this.frm})); new ControllerClass({frm: this.frm}));
} }
trigger(event_name, doctype, name) { trigger(event_name, doctype, name) {


Loading…
Cancel
Save