Quotation Date Validation

Hi! I created a new field in Quotation which is a “Quotation Valid Until”.

Can I create a custom script that will identify if the quotation is already expired by using the date field that I created?

This is the quotation and I added a date at the bottom of the order type.

@Bernard_Gresola

yes, you can add validation for that using custom script.
Please go through the following link which will explain you to add validation for date and also you get an idea of the custom script.
Custom Script

Hi, thanks for your reply. Do you know how to code it? I’m new to Python and I want to learn more. Hope you will help me.

@Bernard_Gresola
change your field type to Date instead of Datetime. Try following script.

frappe.ui.form.on("Quotation", "validate", function(frm) {
	if (frm.doc.quotation_valid_until < get_today()) {
		msgprint(__("Quotation is expired"));
		validated = false;
	}
});
  • quotation_valid_until is your field_name of Date.

Hi @Sangram

where would I put this code??

Regards

@olamide_shodunke

you can add it in Custom Script.
See this more details
Custom Script