How to override frm.event?

Payment_entry.js has the method get_outstanding_documents:
I need override this method, but he is called by event.
How to do?

@Westfallx,

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

1 Like

I am going to override js event i am facing some issues

  1. Create new app and write js code in it

  2. git path in app hook

  3. 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

@shahzad_naser did you find a solution to this