odooodoo-14odoo-15odoo-16

How to restrict hours to specific period in odoo calendar


I want to change calendar time period with some user input field. eg.: in week calendar, I want to show only business day (8AM - 5PM) not (0AM - 12PM)


Solution

  • For that, you must update businessHours of fullcalendar instance

    fullcalendar has setOption() method for option update.

    Odoo instantiate fullcalendar in setup() method of CalendarCommonRender component.

    Inherit that component and after completily mounted call this.fc.setOption('option_name','option_value) where you need to update fullcalendar option