Can't make a Sales Return, delivery status error

It’s need to make a Sales Return on partially paid Sales Invoice, but when you trying to save Return Sales Invoice, appears a Message window (‘Update Stock’ can not be checked because items are not delivered via INV-XXXXX). Can’t understand this, because this Sales Invoice delivered, and Delivery Note has status ‘Completed’. Another problem is that when you change the quantity of the returned goods (because part of this goods were delivered and paid) in Return Sales Invoice, appears a Message window that Debit and Credit not equal for Sales Invoice #INV-XXXXX. It’s strange because we have a Payment Entry for this Invoice. Ask for help

When you’ve made a Sales Invoice and a separate delivery note for dispatching the items, you cannot check Update Stock in the return invoice.

You can return the items back via the Delivery Note and then create another Delivery against it, or issue credit note against the invoice.