I have a web form with this code in the custom py file:
def after_insert(self):
frappe.enqueue('path.to.mymethod',
self=self,
)
And I have setup email notification on the Settings>Notification with trigger after_insert
This code works well when email notification is not active.
When notification is active, the code stops at after doing validation again (there is def validate
before this def after_insert
).
But the email is still sent.
If I set the trigger at New
, the enqueue is working. But the subsequent code which has frappe.get_doc('doctype':'CustomDT')
(which get data from the webform) said the doctype is not found.
Which actually the doctype has been saved when validation is done.
And the email is also still sent.
This is the error I got:
2020-10-20 09:13:05 rq.worker ERROR: handle_exception 839 frappe.exceptions.DoesNotExistError: CustomDT {'filename': 'fielddata'} not found
And this is the last line of traceback:
frappe.exceptions.DoesNotExistError: CustomDT {'filename': 'fieldata'} not found
Did I do it wrong or is there any reason the code is stop?