Dolibarr has a built in function to create a “credit note” in invoices for both customers as well as vendors.
Instead of trying to enter negative quantities, you would simply reopen the customer/vendor invoice that detailed your original sale/order and issue a credit note for all or part of the order. The system will update your inventory as well as keep track of the accounting.
There are some hidden settings that might be helpful for your workflows (Home>Setup>Other Setup):
FACTURE_ENABLE_NEGATIVE_LINES = 1 //This allows negative lines in invoices
STOCK_ALLOW_NEGATIVE_TRANSFER = 1 //This allows negative stock transfers, but I don’t know if it allows negative receptions? Try it out and report back!