Can not Cancel Sales Invoice


I have few Sales Invoices which I can not cancel because the linked Sales Orders are cancelled previously. I don’t know how it allowed me to Cancel the Sales Orders before without cancelling the Sales Invoices first, maybe it happened due to a workflow that I tried.

These Sales Invoices do not have any accounting impact but they are showing on some reports. I need help how to resolve this issue. Can I try deleting them using any database query? If so, what should I do?

Check in selling settings if the “Is Sales Order Required for Sales Invoice & Delivery Note Creation?” field is set to yes? If it is, then change it to NO and try again?

Hope this helps.

Thank you. But it’s set to No. It’s been set to No from the beginning.

@michelle I can think of two possible ways. First, somehow making that linked Order completed/submitted. Second, un-linking the Invoice from the Order. But I don’t know how I can achieve that.

You have to enable the allow on submit option in the linked field from doctype if your developer mode is enabled after that you can unlinked your sales invoice from sales order.
Once you unlinked the same you can cancel or delete the invoices.


@Ranbir Thank you for your reply and I’m sorry that I couldn’t get back earlier.

I tried to understand the process you described but unfortunately I’m not sure how to do it. The application is in developer mode.

The only link field I found on the Sales doctype is the sale_order link field in sales_invoice_item doctype. I enabled the ‘Allow on Submit’ on that field and tried cancelling the Invoice again. Still same issue.

On the Sales Order/Sales Order Item doctype there is not link field to Sales Invoice.

Remove the sales order reference from sales invoice and update the form. After that you can able to delete the same.

I will give it a try after having my db backup restored someplace else as this is a production server. Thank you again.

Share your remote , I’ll help you with the same