ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Override whitelisted method


#1

Hello all,
I am trying to override the below whitelisted function.

I have added it in hooks in override_whitelisted_methods also. But it still seems to run the core function still instead of the custom one. I have overriden others which are working fine, only having problem with this one. Checked the path of both the functions and it is also correct.

Any pointers what might be the issue?


#2

I’m having the same problem. I’m trying to override the following whitelisted function:

I’ve added the following to my custom app’s hooks.py:

override_whitelisted_methods = {
    "erpnext.setup.doctype.party_type.party_type.get_party_type": "my_app.my_module.utils.get_party_type"
}

The path to the method has already been tested to be correct. So it cannot just be a wrong path.

Not sure if same thing happens to all other whitelisted methods elsewhere in the ERPNext or Frappe apps. Hopefully someone has an idea what’s going on. Or at least an idea where to check for the problem.


#3

Other whitelisted methods are working as mentioned in the screenshot above.
Regarding your issue, I believe this function is being called by a link field.
If so you can write a function in your custom app and set use set_query for that link field.


#4

Yes, that’s right - the method is called by a link field really. I’ll try your suggestion. Thanks.