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
- Boekhouding
- Voorraad
- PoS
- Project
- MRP
Deze vraag is gerapporteerd
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.
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
Aanmelden