Override a non whitelisted method

Hi,
I want to add the possibility to have multiple contacts with a lead.

The method load_address_and_contact don’t create contact_list if doctype is lead. I want to override this by my method that is the same unless the condition if doc.doctype != “Lead” in order to have contact_html field populated.

I made a test with hook override_whitelisted_methods but it don’t seem to work.
override_whitelisted_methods = {
“frappe.geo.address_and_contact.load_address_and_contact”: “erpmodifications.erpmodifications_crm.my_address_and_contact.load_address”
}

Any idea ?

Thanks
Xavier

@Xavier_Raymond,

load_address_and_contact method is not whitelisted method that’s why override_whitelisted_method is not working.

To make load_address_and_contact method whitelisted please add the frappe.whitelist() before the method.

Thanks,
Makarand

1 Like

Hi @makarand_b, thanks for the reply.
It’s ok but address_and_contact.py can be overwritted by an update and i can loose the changes.
However i have modified the method but your approach is better than mine.

Xavier