Override standard controller methods in erpnext with custom app

Override standard controller methods in erpnext with custom app like (calculate_contribution method in selling controller)

Check the docs here Hooks

In your custom app custom_app/custom_app/__int__.py file

For Example

from erpnext.controllers.taxes_and_totals import calculate_taxes_and_totals
from custom_app...<path_to_file> import calculate_item_values
calculate_taxes_and_totals.calculate_item_values = calculate_item_values

3 Likes

@jamsheer Hello brother, I’ve tried to add the first line(from erpnext.controllers…) that you’ve mentioned. But I don’t know how to set path for the custom path? What is that custom path means(from custom_app…<path_to_file> import )? Could you please elaborate this?

Thanks in advance!!!

Custom app means the frappe app that you created

That worked, thanks

This article helped me