I have a view with a date field. The user must not select a date after today. How can I disable all days after the current date in Odoo datepi
.cker?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
Give
options="{'datepicker':{'maxDate': 'now'}}"
Hello,
You refer below link.
https://stackoverflow.com/questions/61673978/how-to-disable-days-after-current-date-in-odoo-datepicker
Hi Ernesto:
The syntax seems to be as follows:
<field name="...." options="{'datepicker': {'maxDate': '<date in local format>'}}"/>
You can also pass in a 'minDate' if you want to restrict the values in the field to a date range.
For example,
<field name="validity_date" options="{'datepicker': {'maxDate': '5/8/2020'}}"/>
However, there does not seem to be a way to pass the current date ('5/8/2020' in this example) as a variable. Hoping someone else can throw some light on how to pass the current date in place of the string '5/8/2020'. Using current_date does not seem to work within options.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up