Aggregate fields are not calculated as configured after custom function update

Aggregate fields are not calculated as configured after custom function update

After updating the list price of a product in a quote via a custom function, the aggregate fields (subtotal, tax, grand total, etc.) are not updated according to the field configuration. 

In my project the Sub Total field is configured to sum the Amount of products. Which is working fine as long as the product list price is updated manually.

But if the list price is updated via a custom function the Sub Total will sum up the Total values instead. This results in applying the taxes twice to the Grand Total. See attachment.

So, when updating the list price via a custom function we still have the issue descripted here: https://help.zoho.com/portal/en/community/topic/wrong-subtotal-in-invoice