Odoo 13.0 became a very handy web application that you can configure on the fly with no coding. Much of the customization you need can be done from the browser with some limitations like integration with other apps.
Follow the below steps to add constraints on a date field with no code.
1. Go to the “Automated Actions” form Sittings.
2. Create new and fill the data:
Write the name of the action in the “Action Name” field.
Give the object from “Model field”.
Choose on creation from “Trigger Condition”.
Choose execute python code from “Action To Do”.
From “Apply on” you have the option to add domains.
3. Under python code,
write this expression to get today's date and compare it with the x new date that will be triggered. Then to show the invalid date warning message write this expression:
“raise warning (“Invalid Date”)”. Then Save.
4. Now from the Sales module Create new quotation and try to add the date of
today or a date in the past, that will trigger the warning message and will not
accept the entered date.
New code lines can be added more if you need and also this can be archived, deleted or duplicated anytime.
Now you can create another sales order in the past with no constraints and no limitations easily. You can get back by un-archiving and just by creating it. This is how to add constraints using Automated Actions with minimal code.