How to set a value in child form?

Hello,
In my sales order items, I want to enter the amount and item rate should be calculated based on qty.
how can i set a value in child from?

@Amalendu
Try this one -
Write custom script for Sales Order as below

frappe.ui.form.on("Sales Order Item", "qty", function(frm,cdt,cdn) {
	d = locals[cdt][cdn]
	d.rate = // your value for rate
    d.amount = // your value for amount
});
1 Like

@Sangram
Thank you… It works!
But When I change rate, the amount also gets changed! How can I stop this? Could you please…

@Amalendu
It’s default functionality
your amount is based on rate and qty
amount = rate * qty

@Sangram yes. But I want to remove that function. How can I? in sale_order.js OR sales_common.js file i can’t see where it is to comment the code!. I am using Version 6.27.