Hi everybody;
H need to show total price before adding discount
so i created a custom field “total before discount” which just will be total of all items price list rates, I made this custom script for automatically make this calculation but not working
total before discount always =0 why?
`frappe.ui.form.on('Quotation',"price_list_rate", {
validate: function(frm) {
total_qty = 0;
$.each(frm.doc.items || [], function(i, d) {
total_qty +=flt(d.price_list_rate);
});
frm.doc.total_before_discount=total_qty;
frm.refresh_fields();
}});
`
you cannot assign value to a field using ‘=’,
use
frm.set_value("field_name","value")
neerajvkn:
frm.set_value
also not working it still 0
frappe.ui.form.on('Quotation',"price_list_rate", {
validate: function(frm) {
total_qty = 0;
$.each(frm.doc.items || [], function(i, d) {
total_qty +=flt(d.price_list_rate);
});
frm.set_value('total_before_discount',total_qty);
frm.refresh_fields();
}
});
check & see if the value is actually getting computed and stored in total_qty in each iteration by printing it to console or something
correct this to your appropriate trigger,
frappe.ui.form.on('Job Card Entry',{validate :function(frm){
it works now thanks so much