Wrong on_change* calls order
The on_change_with are called with the value prior to the on_change calls, so the result is wrong because it is based on the wrong data.
Ex: on a sale line, if you change the quantity which result in changing the unit price, the amount is computed with the previous unit price.