Delivery note posts cost of sales

I noticed that creating a delivery note records an accounting entry of cost of sales. This can be confusing and misleading from an accounting perspective. Also it leads to unnecessary extra entries in COS account which do not have Corresponding sales entries especially when there are short deliveries.

Is there any way i can setup that cost of sales is charged at time of creation of invoice and based on number of items stated in invoice?

No way out

Sales Invoice updates revenue
Delivery Note updates Cost Of Sales

Try and make sure the two are posted in the same period.

Ideally the best option is to raise Sales Invoice WHEN delivery note is made.

This is a genuine issue and needs to be thought through.
Many organisations do partial deliveries and invoices periodically. take the example of a project-based company. they will do deliveries throughout the year and then create invoices quarterly only.