ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

How to refresh total before save

Hi all, I am trying to refresh “total” field in sales order .i made two custom fields and the amount calculation changing on that but the total is not reflecting while change in amount. please guide me how i can update the total before save.
after saving its reflecting correct. while creating the delivery note its again get the same value i need to save it then its reflecting the exact value.

as i am attaching a snap where i change disc field (discount) and its reflecting the amount correctly before save but the total is not updating please guide me in that.