Hi:
I have this issue:
I would like to make some extra validation (and eventual change of data) on the GL Entry
records (documents) that should be performed no matter the source of the document that writes them (ie: Journal Entry
, Payment
, Invoice
, etc).
What is the best way to do it without modifying Frappe/ERPNext source code?
Please, let me explain in detail:
For certain Account
records (documents) we have extra fields that optionally define a required Party Type
and Party
.
Now, when any GL Entry
has those specific Accounts
there should be a validation to check whether those fields are set or not, to write them using the defined for the Account
, or warn the user if the received don’t match the specification.
I’m stuck on what mechanism to use for this case. I have been able to write a Server Script
customization for the Journal Entry
associated to its DocType Event
Before Validate
.
The reason I don’t try the same for other documents like Invoices
and Payments
is that I think there is always the chance that other document does not verify our requirement.
That’s why I’m thinking of perform that validation on the GL Entry
. However using the same type of customization, the script is not validated, in fact, it seems it never gets called.
Is it possible to make that validation on GL Entry
? Hopefully, using the customization options instead changes on the source code or custom apps.
Thank you!