Addition of two coloumn values

Hi.
I want to do addition of two coloumn values of table which addition will show in another coloumn.
I tried some times but it didn’t work.
So please give any suggesion about that.
I did by updating code using new custom script.

that’s not very clear, can u explain in a better way?

In Sales Invoice doc there is a table in which two coloumns product rate and labour rate,which coloumn values i want add, this added value should display in another coloumn which is amount coloumn

Can u post a screenshot? Is that a custom table?

ok. I ll put screenshot.please wait…

So, what u want to do?

are you trying to calculate amount = qty * product rate * labor rate ?

I want to addition of product rate and labour rate coloumn which addition will show in amount coloumn

so amount = product rate + labor rate ? could you provide the exact field names?

In Sales Invoice custom scrip windows place

frappe.ui.form.on("Sales Invoice Item", {
	labor_rate: function(frm, cdt, cdn) {
		var d = locals[cdt][cdn];
		var total = 0;
		frappe.model.set_value(d.doctype, d.name, "amount", d.labor_rate + d.product rate);
        refresh_field("amount","labor_rate");
        
	}
});


frappe.ui.form.on("Sales Invoice Item", {
	product_rate: function(frm, cdt, cdn) {
		var d = locals[cdt][cdn];
		var total = 0;
		frappe.model.set_value(d.doctype, d.name, "amount", d.labor_rate + d.product rate);
        refresh_field("amount","product_rate");
        
	}
});

Yes. I provided…Ok I ll check below code

I ll check…thanq

Hi Randy, Thanks for the elaborate help. But I am trying the same solution with @komalkore but some how we are not able to get the script working. So its a child table “Sales Invoice Item” which is part of parent “Sales invoice”. We also tried adding a msgprint statement but that too didnt work. This is latest environment ERPNext ver 8.07.

can you provide the exact field names your are using?

This is the snapshot from sales invoice team item . and below is the script that I added -

Since product rate field is called only rate lets replace it in the scrip. try like this:

frappe.ui.form.on("Sales Invoice Item", {
	labour_rate: function(frm, cdt, cdn) {
		var d = locals[cdt][cdn];
		var total = 0;
		frappe.model.set_value(d.doctype, d.name, "amount", d.labour_rate + d.rate);
        refresh_field("amount","labour_rate");
        
	}
});


frappe.ui.form.on("Sales Invoice Item", {
	rate: function(frm, cdt, cdn) {
		var d = locals[cdt][cdn];
		var total = 0;
		frappe.model.set_value(d.doctype, d.name, "amount", d.labour_rate + d.rate);
        refresh_field("amount","rate");
        
	}
});

Also do refresh your browser after save the scrip

tried same…but didn’t work

haven noticed it, do place the scrip under SALES INVOICE doctype. currently you placed in sales invoice item doctype.