Sales invoice item Custom Script

I want to the change the amount of sales invoice item based on qty_pc & rate.

PS: I have already added qty_pc using customize form.

I am using the following code but its not working, Please help me out.


Sales Invoice Item

frappe.ui.form.on("Sales Invoice Item", "qty_pc", function(frm) {
   frm.set_value("amount", qty_pc*rate); 

@avaiskhatri, do:

frappe.ui.form.on("Sales Invoice Item", "qty_pc", (frm, cdt, cdn) => {
    var d = locals[cdt][cdn];
    frappe.model.set_value("amount", d.qty_pc * d.rate);
1 Like

Thanks man. :slight_smile: