Doc_events hook in is not triggered when ERP Loan status changes?

My doc_events in has the following data

doc_events = { "Loan": { "on_update": "myapp.api.test.test_hook2" }, }

Shouldn’t the above hook fire when the Loan status changes
from Sanctioned → Disbursed → Loan Closure Requested → Closed?

The hook is fired initially when I create a loan from the desk with the status as Sanctioned.

Would really appreciate any help.


Try on_change event

Doesn’t work.
The loan status changes after I make an entry in Loan Disbursement

I am not changing the Loan status manually.

related: entries not being picked up - #7 by AdityaHase

I tried and checked everything mentioned in the thread.
Nothing works.

This doesn’t work in production and also doesn’t work locally in dev mode.

After changing hooks always do bench clear-cache

Doesn’t work.
Checked the code found the issue,
The status of the loan is updated by raw SQL.

And that’s why hooks are not firing.