Price Rate in purchase with different UOM

wanted to display Amount (INR) as per Rate (INR) * Qty as per Stock UOM.

Rate (INR) * Qty as per Stock UOM = Amount (INR)

For Ex. If i have added 1 pencil and 1 pencil price is Rs.4 and if i add 1 box pencil which is 10 pencil = 1 box pencil so 1 box pencil price should Rs. 40. That is not updating Rs.40. updating 1 pencil price Rs.4

How can i write custom script for this or missing some setting…?.

Do you have a price in the price list for this item?

Your choice in this document is to get the price from the price list (last purchase rate), if the price list don’t have any prices so it won’t show it.

Also, you should actually put the amount manually in anyway, don’t think it should change the price depending on the UOM (it’s unnecessary coding to do that)

Have a look at the Purchase UOM and Stock UOM Conversion function , it may help

Thanks for response. We have tried but not working.

We dont know the price of box.

We know only price of One unit. Nos.

Rate (INR) * Qty as per Stock UOM = Amount (INR)

I’m writing below script for updating Amount (INR). Qty as per Stock UOM. Getting SyntasxError : -Invalid or Unexpected tokan.

Please guide me how to write script for update amount as per stock UOM.

frappe.ui.form.on(‘Sales Order Item’, {
refresh(frm) {
var d = locals[cdt][cdn];
var amount = (flt(d.stock_qty) * flt(d.rate)) ;
frm.set_value(‘amount’, amount);
}
})