laura
March 10, 2016, 5:39pm
1
Hi all,
In Expense claim details form I add a new field named kms. I want calculated the claim amount as kms*25 if claim type is Travel. I can do this with custom client script or not? I try to create a new client script but without success…
thanks
Laura
@laura
write custom script :
For Doctype - Expense Claim
as below:
frappe.ui.form.on("Expense Claim Detail", "km", function(frm, cdt, cdn){
var d = locals[cdt][cdn];
if(d.expense_type == "Travel" && d.km){
d.claim_amount = d.km * 25;
frm.refresh_fields();
}
})
1 Like
laura
March 11, 2016, 10:04am
3
Thanks Sangram,
I’ve put yor script into custom client script for doc type Expense Claim but it doesn’t work…
Some suggestions?
@laura
Replace km with your field name. I think fieldname is kms as you mentioned in post.
and try again…
laura
March 11, 2016, 10:19am
5
I replaced k with m kms but I forgot to do so in the if condition.
I’m sorry.
now works fine.
Thanks!