Try ERPNext Buy Support Partners Foundation Foundation Members

Override whitelisted method

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?

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.

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.

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

Did the first override get_product_info_for_website work for you when loading product in website? Checking frappe/frappe/handler.py seems like the hooks are never called for website methods as there is no “cmd” in the request

@kartik, does override works for you in v12?

Sorry. No idea. I faced this issue on v11.