If you are not able to delete a document (e.g. sales invoice) and receiving the message below, it is because there is an inventory count document created after the document you are trying to delete.
The message reads the following:
Selected action is not allowed
Existing inventory count found. Document <document number> created on <date and time>.
Check document stock date and try again.
The reason why you are not able to delete a document is because it would affect the inventory count that is already created, so that inventory count and your current stock quantities will be incorrect.
When you create an inventory count, it is calculating the quantity for specified stock date and is using that quantity as a base value for the quantity change. If you delete a document preceding that inventory count, values would not be correct anymore.
I still want to delete the document, what can I do?
The only way to delete a document preceding an inventory count is to delete the inventory count(s) created after the document you are trying to delete.
Of course, this means that the products in a document you are trying to delete must not exist in any inventor count added after, so may need to delete more inventory counts to achieve this.
Deleting inventory counts is not recommended, as that affects your current and previous stock quantities.
If you decide to delete an inventory count, please make sure you check the quantities after and, if required, fix it by creating new inventory counts (or other documents), so your stock quantities are correct and up to date.