Relevant function for Sales Invoice

When I change the quantity of an item in the Sales Invoice, the amount for that item gets automatically updated.

In which file is the code for this automatic updation written? I scanned sales_invoice.py and sales_invoice.js and couldn’t seem to find it.