Saving a new doctype entry without running validate

Hello so, I’m trying to add a bulk number of documents using a server api call, however whenever i run it for a certain doctype i get a 504 gateway timeout. I have reason to believe that its because the validate method on the document is taking time to execute. it there anyway to jump the validation step when i create a new doc. Thanks

image

depending on your exact needs, some combination of:

new_doc.flags.ignore_mandatory = True
new_doc.flags.ignore_validate = True

…should work.

1 Like

Thanks, this block the validation. I still seem to be getting the time out though, i figure i’ll have to do a bit more testing to fine the main cause

Depending on the number of lines in your json import, the method above could be very computationally intensive. For (potentially) large batch jobs like this, it’s usually better to use background jobs/enqueue:

https://frappeframework.com/docs/v13/user/en/api/background_jobs

1 Like