I am trying to set a webhook upon Sales Order submission but encountered this error.
Any help?
frappe.integrations.doctype.webhook.webhook.enqueue_webhook
Traceback (most recent call last):
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/rq/worker.py", line 793, in perform_job
rv = job.perform()
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/rq/job.py", line 599, in perform
self._result = self._execute()
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/rq/job.py", line 605, in _execute
return self.func(*self.args, **self.kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 103, in execute_job
method(**kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/integrations/doctype/webhook/webhook.py", line 73, in enqueue_webhook
raise e
TypeError: datetime.datetime(2019, 4, 1, 15, 41, 31, 308297) is not JSON serializable
Hi what is your input here - a screenshot of that or if you copy and paste the code you entered would help troubleshoot this
thanks
Hi clarkej,
Here is the screenshot of webhook settings.
However, I have added
from datetime import date, datetime
in file webhook.py and it seems working.
But, I am afraid, this will be deleted when I update erpnext to next version.
Yes correct ‘server side’ code customizations are best stored in a separate custom app, to be merged and not overwritten by code updates to the ERPNext and Frappe base apps.
Do you know how can we store this in a separate app?
Frappe’s library tutorial gives a custom app example. Here all changes are limited and stored as ‘server side’ code.
OTOH ‘client side’ customizations as documented here are all stored in the database and are not affected by bench updates (but nonetheless are not immune to breaking changes)
What is the general rule that distinguishes the two? My understanding is that Python code changes are limited to the server side.