Inventory Balance Quantity problem

Hi Team,

We have been able to do things in a good shape for creating invoice through Frappe REST Api.

However, we are facing an issue with inventory. Like, when the invoice is generated and closed on creation itself, the inventory is not updated properly. The item count doesnt reduce. Instead, it shows 0 and moves ahead.

This is about an entry inside the Stock Ledger - for instance

Here, the Balance Quantity reduces on each stock deduction entry.

However, this Balance Quantity becomes 0 when we close the invoice through REST Api. What is going wrong here?


Please help us with the following information, so that we can further support on this issue.

  1. Which application it is linked to?
  1. Is Delivery Note made separately?
  2. If not, then in the Sales Invoice, is “Update Stock” field check?
  3. What was the stock of an item before Sales Invoice creation? Did it have positive stock balance?
  4. Please share as many screenshots as possible (via Imgur), so that we can get the context.

Hi Umair,

Please find answers inline to your questions



When Sales Invoice is closed via Rest API, is Submit function called on it? As per the design, stock and account posting on the invoice is only done when it is submitted.

If possible, please share the code and logic written for submission and closure of the invoice.