Workflow Action Condition in Childtable

Anyone helps on workflow condition

Purchase Order Item
Each Line items

rate > price_list_rate (Need to for an approval) Purchase manager

How can i write it down in Loop?

A bit related, you can sum rate, and price_list_rate, into custom fields on the parent doctype, and use those custom fields on the parent doctype on your workflow.

See example below.

frappe.ui.form.on('Sales Order', {
	validate: function (frm) {
		// calculate total rate and price list rate for each line item
		var total_rate = 0;
		var total_price_list_rate = 0;
		$.each(frm.doc.items, function (i, d) {
			// calculate total rate          
			total_rate += flt(d.rate);
			// calculate total price list rate
			total_price_list_rate += flt(d.price_list_rate);
		});
		frm.doc.line_rate_total = total_rate;
		frm.doc.line_price_list_rate_total = total_price_list_rate;
	}
});
2 Likes

@glz Super Thanks :slight_smile:

Done. !! Thank you

1 Like