I added some code that changes the document during on_submit(). Once I submitted the document the form UI was updated with the changes. But when I reloaded the document the changes were gone. Is this a bug or are we not supposed to change the document model in the on_submit() function?
Can you share your code?
Yes. Simply modify file journal_entry.py: move self.create_remarks() from validate() function into on_submit()
Here’s the link to the code
I recommend you run your custom code on
Yeah that is fine, I am doing that. But the fact the ERPNext is showing the changes in the UI but not storing the changes is DB can be a problem. If it didn’t show up in the UI then the developer might assume that on_submit( ) is not meant to persist changes, but this current mechanism is either bugged or is just simply misleading.