Fix for amount stuck in Unreleased balance when using API endpoints

Order To Cash: Sales Invoice Version 10.35

When using API endpoint to create a sales order and a prepayment, after releasing them, the system would calculate a wrong customer unreleased balance. This has now been fixed.