POS : Sync error: root cause, one of them

I dont know if it is a bug or a feature. But this is what happened.

I had an item, where i had limited the max discount allowed to 15%. On the POS, I created a sale and gave it 25% discount and on the grant total another 50% discount. After that I collected the cash and submitted the transaction.

So far so good.

Then I made another 10 transactions. And then I went to check if If all of these had sales invoices. I found nothing. So i was a bit surprised. Then a message kept popping up, with no reference to anything or where it was coming from. It keps saying “Item code xxx exceeds max discount 15%”. I did not pay attention to it for a while.

So this is what i found out. Because of this issue of giving a huge discount, the offline POS (I was online all the time) submitted this transaction. The server tried to validate it and since i had exceeded the discount% it rejected with a java (looked like a java error) error. The message was spit out by the browser without context.

And because of this, all the following transcation got blocked (because it was in a queue). And basically it was a pile up. One error and all the following transaction got held up.

My suggestions if anyone is looking to fix it (I cant). Make the queue async. i.e. if one transaction doesnt go through , others are not blocked. That way, the number of lost transactions are limited.

Secondly better error description and context. So there should be some wrapping. Server side error should be wrapped up by front end to show where it was generated. Because of this offline thing, we move on to other things and an error pops up completely un-related to what we are doing now.

Hope it is helpful.

BTW: I went and changed the item master data, and the queue just cleared in like 10 seconds after that.

Would be great (1) if offline transaction is erroring out because of validation, we can fix it by changing something or cancelling the transaction and creating a new one. Secondly, the queue should be held up by 1 bad transaction.

Thanks

Hi @Deepak_Pai

Can you make Github Issue for this, soon we’ll fix this issue

Done.

https://github.com/frappe/erpnext/issues/10278