Missing invoices in Offline PoS

Maybe one way is to monitor the size of the local storage using something like the suggestion here but embedding the size in the POS page so that you can start to see when it reaches the danger point of space consumption:

See space consumption for a dormant POS profile
image

One can then stress test by posting a large number of POS entries online/offline and seeing where things start to disappear or what happens when the upper limit of localstorage is hit before a synchronise occurs

I am currently checking this out.

The syncing of Sales Invoice is a single request. (e.g. 150 invoices to one API call)
Inserting 150 invoices could be a huge overload for a server.

My idea is that if we can manage to breakdown 150 invoices into 50 invoices of 3 API calls.
Maybe, it would fix the problem.

Regards,

Ivan

Makes sense

@iRaySpace is this something you want to take a look at?

I have mistake, recently checkout the core code. Current implementation is one API call synced 49 invoices.

Could we reduce this to 20? or 10?

Maybe we test this scenarios and see if this reduces or eliminates the missing data issue

Where do we make this change(s)

@rohit_w you are the acknowledged father of Retail PoS :slightly_smiling_face::slightly_smiling_face:

Can you help with

  • Either pointing us in the direction of how to reduce the maximum number of invoices each API calls at once or

  • Any other approach to resolving this missing invoice issue? It is a real thing and a big deal

If it will take time we are willing to pay for the hours involved

Regards

Hold on. There is some work ongoing now. Will update soon.

2 Likes

Hope to get some feedback soon…

I think using cypress to simulate a large volume of POS invoices in online/offline conditions would be the way to go. Each invoice pushed from cypress should have a unique identifier that can be used to correlate it with the submitted POS invoices in ERPNext. Comparing the two sets of invoices might help to pinpoint the error.

1 Like

Hi @Chude_Osiegbu

What is Cypresse ?

https://frappe.io/docs/user/en/ui-testing

1 Like

Thanks

Though I have a real life store that we are using for testing.

They generate about 500 receipts daily and they print a store copy for control purpose.

We lose 3 to 4 of this daily and we are able to identify the missing invoices for reposting

Right now there is no discernable logic to the missing invoices. It is just random

We have made some changes to the pos bahrain app which sync in batches also rewritten js code natively. Theoretically it should not miss any invoice. But most of are clients don’t have high frequency sales if anyone can test it and confirm if it helps.

Thanks

Would be good to have some kind of diagnostic tool that logs:

  • timestamp when local storage size nears is maximum
  • timestamp when network availability changes

and correlate them with the time stamp on the missing invoices.

Is it ready to test now? @Muzzy said it needed some finishing

It is ready but I have not merged it as we have some live projects going on which we make changes constantly.
This is the PR
https://github.com/f-9t9it/pos_bahrain/pull/148

I will merge it now.
If you can test it today itself and help me with the results?

Thanks.

Hello @fkardame and @Muzzy

We have been testing the new pos_bahrain for the past 5 days in a client location

The client does about 600 invoices daily, using offline invoices

We used to have on the average 3 missing invoices daily

For the past 5 days we have had none…zero.

I am not jumping for joy yet but this is looking hopeful.

I will be extending this to another client location with a larger invoice count.

What are you getting from your end?

2 Likes

Hi. Good to hear this. Fortunately we had rare instances of missing invoices since we built POS Bahrain. We had kept strict instructions of having pos open on only 1 tab of the FireFox browser. But thanks for the feedback. This will surely put our mind at ease.

Can you give brief of how you are tracking every invoice. Are you printing in duplicate (1 for customer and 1 for the shop) to conclude that there are no missing invoices? The duplicate would match with the daily sales invoice.

Not sure what has made the probable fix. Is it rewriting of the code in native language, sync settings or mix of both. The more it’s used in production the better would be confirmation that no invoice is missing. Looking forward to hearing from you about the other clients as well.

In this particular client location we agreed on the following

  1. Printing of duplicate invoice, one for the customer and one for the shop/control
  2. At end of day we count the number of invoices on hand against the number of invoices submitted on ERPNext.
  3. We also sum up total value on the physical invoices versus total value on ERPNext.

It is a lot of work, but it needed to be done

I will keep you updated as we extend this to another client location.

Regards

3 Likes

Hi @olamide_shodunke just wanted to know if there were any more missing/duplicated invoices since then? One additional fix we had done for a client was increasing Gunicorn workers to 8 from 4 on a 4 core 8 GB RAM VPS. This seems to have fixed the duplication of invoices.

1 Like