Payment_entry.js has the method get_outstanding_documents:
I need override this method, but he is called by event.
How to do?
It not possible to override the get_outstanding_document
method from payment_entry you will need to make changes directly in the payment_entry.js
Although, get_outstanding_document
method calls the get_outstanding_reference_documents
whitelisted method through frappe.call and you can override the whitelisted method from hooks.py
check override_whitelisted_methods
hooks
Thanks, Makarand
I am going to override js event i am facing some issues
-
Create new app and write js code in it
-
git path in app hook
-
overridden function works but default function also executed after that which overwrite my changes
There is also a frappe off function which delete that event. (In my case that event not deleted)// remove standard event handlers
frappe.ui.form.off = function(doctype, fieldname, handler) {
var handler_list = frappe.ui.form.get_event_handler_list(doctype, fieldname);
if(handler_list.length) {
frappe.ui.form.handlers[doctype][fieldname] = [];
}if(cur_frm && cur_frm.doctype===doctype && cur_frm.events[fieldname]) { delete cur_frm.events[fieldname]; } // for debuging console.log(doctype, fieldname, cur_frm); if(cur_frm && cur_frm.cscript && cur_frm.cscript[fieldname]) { delete cur_frm.cscript[fieldname]; }
}
every time when i want to off that event
frappe.ui.form.off("Leave Application", "calculate_total_days");
this show mein in console that cur_frm is undefined. I think that why events are not unbinded.
any one help please
frappe.ui.form.off(“Fees”, “fee_structure”)
cur_frm.cscript.fee_structure = function (frm) {
console.log("hello ..............................s")
}
Is this the solution?
Yes, this is the solution. I did the following to disable the existing and add the new one for the same.
frappe.ui.form.off("Material Request Item", "qty")
frappe.ui.form.on("Material Request Item", {
qty: function (frm, doctype, name) {
// Do something else
}
})