Custom script for sales invoice item not working

i need to change amount calculation for each item to be
amount=rate * qty * custom_field
i tried that but not working any help??

frappe.ui.form.on("Sales Invoice Item", "custom_field", (frm, cdt, cdn) => {
var d = locals[cdt][cdn];


why not working what’s going wrong?

Try frm.refresh_field("amount");



after frappe.model.set_value("amount",d.custom_field*d.rate*d.qty);

thanks for response but still not working :pensive:

@Zeinab_Mohammed the properly sintax of frappe.model.set_value is frappe.model.set_value(cdt, cdn, "amount", d.custom_field * d.rate.dty)

And pls, dont tag directly people!

Refer to here How to change total amount calculations

1 Like