Hi ,
I’m using ERPNext / Frappe v15 and have overridden
erpnext.controllers.taxes_and_totals.calculate_taxes_and_totals using a monkey patch in hooks.py.
I’m overriding it like this:
def override_calculate_taxes_and_totals():
import erpnext.controllers.taxes_and_totals as taxes_and_totals
from custom_app.taxes_and_totals import CustomTaxesAndTotals
taxes_and_totals.OriginalCalculateTaxesAndTotals = taxes_and_totals.calculate_taxes_and_totals
taxes_and_totals.calculate_taxes_and_totals = CustomTaxesAndTotals
override_calculate_taxes_and_totals()
This works correctly when:
Creating or updating documents from the UI
But it does not work when updating multiple documents via bulk update / background workers.
This is Works fine on a self-hosted Ubuntu server but Issue happens only on Frappe Cloud
Is there any limitation or recommended way on Frappe Cloud to ensure monkey-patched overrides like calculate_taxes_and_totals work reliably in background jobs / bulk updates?
Thanks!