Search code examples
pythonodoo

How to disable days in Odoo Datepicker before a date?


I have a model in odoo with a fields.Date attribute (expiration_date) How can I disable all days in its odoo datepicker before a date (like january 2016), so all those days before january 2016 would not be accesible in odoo datepicker?


Solution

  • You need to specify the minDate option of the date picker widget.

    To disable dates before January 2016 we can pass the date as a string:

    <field name="date_invoice" 
           options="{'datepicker': {'warn_future': true, 'minDate': '2016-01-01'}}"/>