Delivery Note Challenges related to acutal_qty

Hi all,

One of my client implementations just witnessed a weird issue.


Client is on:

ERPNext: v13.39.2 (version-13)

Frappe Framework: v13.41.3 (version-13)

They Make a Sales Invoice first from a Sales Order. Update Stock is not checked on the Sales Invoice. Later they ship the Items in the Invoice and when they do that they make a delivery note.

Things have been working fine for about a year now, but yesterday, when they tried to make a delivery note they encountered a strange issue. Details continues after the image:


As you can see, The “Available Batch Qty at From Warehouse” is 1109, but the “Available Qty at From Warehouse” is 4 - and it’s the same item. There seems to be some mistake in the code. However the Delivery Note is not getting submitted as ERPNext is saying 356 Quantity of this item needs to be there for the transaction to go through. The Delivery Note is for 360 Nos of this item.

Has anybody encountered this problem? Any ideas as to where the problem could be and how to correct it?

Please help.