Hi @Kirolos_Fayek,
can explore your process and what you want to rate 0 to save the invoice or not?
Thanks.
Thank you for your answer
I can’t understand you clearly
But I need when rate = 0 do not save
One way to accomplish this would be to create a server script, attached to the “Before Save” hook. Check to see if the rate is set to zero, and if so throw an error.
2 Likes
Hi @Kirolos_Fayek,
In addition to @peterg’s answer, you’ll also set using client/custom script.
Please apply and check it.
frappe.ui.form.on("Sales Invoice", "validate", function(frm, cdt, cdn) {
$.each(frm.doc.items || [], function(i, d) {
if(d.rate <= 0) {
frappe.msgprint(''+d.item_code+'' +" Rate is 0 So set a rate." + d.qty);
validated = false;
}
})
});
Thank You!
2 Likes
It work like a charm