Auto calculate the "rate" when we write "amount" in sales invoice (Paid Help)

I want someone who can do this paid task for me.

when we input “rate” the amount is auto calculated. now i want that when we write amount, the rate also calculated.

when there is change on field rate, it will auto calculate amount, if you implement the logic to trigger calculate rate when amount changed, this will cause endless update on rate, then amount, then rate …?

So what is the business background you need this feature?

1 Like

you can use this custom script :

frappe.ui.form.on("Sales Invoice Item", "amount", function(frm, cdt, cdn) {

    var item_row = locals[cdt][cdn];

    item_row.rate = (item_row.amount/item_row.qty) ;


but you have first made “amount” filed writable.

@youssef How did you make amount field writable?