Deleting a line on a sales order credit note errors on Total of SO_LineDetails.Quantity

Problem

Deleting or decreasing the quantity on an unprocessed sales order credit note can error with 'Total of SO_LineDetails.Quantity does not match SO_Lines.QuantityThisDel'

Solution

When a sales order credit note returning items into stock is saved, the stock is updated into stock on hand and is available immediately for sale, transfer etc.  This error occurs when some of all of that stock no longer exists i.e. is has been sold, consumed on a work order, transferred to another warehouse.  Sufficient stock will need to be transferred in to allow the credit note to adjusted as required.