Error creating invoice for already delivered products

I have an issue in processing invoices via dolibarr. I have created a commercial proposal for a product with quantity of 1, then generated a sales order with quantity of 1 whose payment is due on receipt. From sales order i have generated a shipment of the 1 unit and delivery note reflecting 1 unit was delivered. When trying to generate invoice for the ordered items, i get an error that there is zero stock. Why is this? I am creating an invoice for the item already delivered. How can i resolve this issue?

Which is your Dolibarr version?
How and from where are you trying to generate the invoice?

@sonikf am using 17.0.1. I have attempted to raise the invoice form the shipment, from the sales order and from the commercial proposal. All cases report the same error.