Purchase Invoice creation from Purchase Reciept timing out

Hello,

I checked the browser console when trying to create a Purchase Invoice from a Purchase Receipt which has around 300 items and its shows me the following error messages. Is it a database issue?

POST 504 (Gateway Time-out)

VM262:1 Uncaught SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse ()
at Object. (frappe.min.js:300)
at j (jquery.min.js:2)
at Object.fireWith [as rejectWith] (jquery.min.js:2)
at x (jquery.min.js:4)
at XMLHttpRequest. (jquery.min.js:4)

@keshav,

It is not database issue, try to increase the timeout for supervisor and Nginx

Here are the settings for supervisor:

[program:frappe-web]
command=/home/erpnext/frappe-bench/env/bin/gunicorn -b 127.0.0.1:8000 -w 2 -t 600 frappe.app:application

And this is what is there for nginx:
proxy_read_timeout 120;

How much should I increase them?