Script to stop back date entry

Dear Experts,

I created following script for purchase order to stop back date entry.

frappe.ui.form.on(“Purchase Order”, “validate”, function(frm) {
var date = frappe.datetime.add_days(get_today(), -3);
if (frm.doc.transaction_date <= date) {
msgprint(__(“You can not select this date”));
validated = false;
}
});

It is working successfully for purchase order and sales order (separate script for doctype sales order).

The problem is that it does not work on journal entry,purchase invoice and sales invoice. Please suggest the required changes.

Regards,

Zahid

Hi,

Change frm.doc.transaction_date to frm.doc.posting_date

Thanks, Rohit

@Zahid.Butt

Check concerned fields in concerned doctypes.
as @rohit_w suggested its correct field is posting_date.

Thanks for your time.
It works for journal entry but not for purchase & sales invoice.

Can I have a list of column names for all docTypes.

Regards,

Zahid

Hi,

Yes, using customize form, check field name.

Thanks, Rohit

1 Like

Thank you once again. Its done.

Best Regards,

Zahid