Strange behavior Get Outstanding Invoices In Payment Entry

We have several customers who have hundreds of invoice daily i.e 200 invoices…so in just 3 days they will have around 600 outstanding invoices…when we’d like to make payment via payment entry…I’m facing strange behavior…

If the customer only has around < 100 outstanding invoices , then everything goes normally. when we select party the the screen only freeze 2-4 seconds to load the data…

If the data is over 200 invoices then we select party, nothing’s happened at the beginning but after around 30sec the screen is freeze for quite long time…sometimes getting timeout

Okay, via override_whitelisted_methods hook, I limit sql query to e.g. 50 records…but the behavior is still same…but references table shows only 50 records…I increased http_timeout to 600 too

Can anybody give some pointers how to solve such case? Since I have limited the query to only max 50 records…why there’s still delay around 15-30 sec before the screen freeze to populate reference table…Is it javascript issue? async issue? or?? this only happens with customers who has hundreds of outstanding invoices…seems the query is not executed right after we select party…if the customer only has few invoices then the query is run right after we select party…

PS. I changed file under erpnext.accounts.utils.get_outstanding_invoices for this test to limit the query. I’m using latest v10

Thanks

Are you on the latest version? If yes, then maybe try to use browser profiler to get some idea if it is a network issue or related to erpnext.

Below is the summary of performance profile…

I have limited the query to retrieve only 15 outstanding invoices…but after selecting party, it delayed +/- 20sec before populating reference table…What might the issue here?

Can anybody give some pointers what’s going on here? there’s delay before it loaded reference table even the query already limited to 5 records…it seems somewhere the full-records query were still running in background… To test it I changed the core query directly under accounts > utils > get_outstanding_documents…still no luck… have no ideas now,…it’s just annoying for end users…

It seems the javascript issue?

Are you on the latest stable version of both ERPNext and Frappe? Maybe you should check if the issue still persists on the latest version.

yes i’m on latest version…i’m still facing the issue

It seeme the system still doing full query but it’s odd because I’ve changed the core code directly…What may cause this delay?

What change have you made? Can you share highlighting it?

In my custom app’s hooks.py:

override_whitelisted_methods = {
"erpnext.accounts.doctype.payment_entry.payment_entry.get_outstanding_reference_documents": "custom1.custom1.custom1.get_outstanding_reference_documents2"
}

The problem still existed then I changed core file directly under erpnext.accounts.utils.get_outstanding_invoices to limit sql query to only 5 records…but still no luck…the delay still exists for around +/- 20-30 sec

The delay is gone if the party only has few records (under 100)…it seems javascript issue…I’m on latest v10

Thanks for help

@nabinhait do you have any ideas what caused this?

image

I have no ideas about this ‘long’ waiting time before content download? How to trace it?

I believe its not long database query since I have limited it to max 50 records…even hundreds of records its not sql query issue…

@jof2jc

Not sure if this will help or is relevant, but you might want to check your server’s ping time.

I am encountering the same issue with timeout from one of our remote sites accessing ERPNext and it turns out that the ISPs server was timing out which in turn caused ERPNext to timeout.

Basically, ERPNext is installed in one country, I am in another and the remote site is in another. I am not experiencing any timeouts. But the remote site is.

@saidsl server is normal, no timeout… Its jquery waiting/delay time before first response… I still don’t know how to deal with this.

If I enable async, the delay time not seen, user continues to enter another fields until the time its freeze until the callback its completed…

If I disable async, frappe call is executed right away… The form is freeze until the callback is completed…

But both are the same, the waiting time is too long +50 sec… Database query is very fast… Javascript timeout? Or? Maybe somebody can give ideas…

Thanks

I really don;t know what’ss actually happening here…one customer only has 5 outstanding invoices…But the waiting time aka TTFB reached 3,8 minutes which is very long and slow …this is big problem…anybody can give some ideas ?

Is it server issue?

erpnext.accounts.utils.get_outstanding_invoices is the nightmare…it uses dependent sub-queries which slowdown everything…

1 Like