How do I set field values in child doctypes

I’m trying to do some calculations in Item table of Sales Invoice doctype. The calculations are working but the issue now is that when I save the Sales Invoice, the save button is not changing to submit. I realised that frappe.model.set_value() function is the one causing the issue. Is there any other way of setting a value of a field in a child table. I tried frappe.db.set_value, but not working

@Nyasha_Karata you can just use item.field=value. also doing the math on refresh is not the way you do it . you can do it just when you enter the data . or do it before save using server script .

Thanks it worked