diff --git a/addons/hr_holidays/static/src/js/time_off_calendar/time_off_calendar_employee_views.js b/addons/hr_holidays/static/src/js/time_off_calendar/time_off_calendar_employee_views.js index 6eb95dcc328..6695c08c79e 100644 --- a/addons/hr_holidays/static/src/js/time_off_calendar/time_off_calendar_employee_views.js +++ b/addons/hr_holidays/static/src/js/time_off_calendar/time_off_calendar_employee_views.js @@ -1,12 +1,14 @@ /** @odoo-module **/ import { TimeOffCalendarEmployeeController } from "./time_off_calendar_employee_controller"; +import { TimeOffCalendarModel } from "./time_off_calendar_model"; import { TimeOffCalendarView } from "./time_off_calendar_views"; import viewRegistry from 'web.view_registry'; export const TimeOffCalendarEmployeeView = TimeOffCalendarView.extend({ config: Object.assign({}, TimeOffCalendarView.prototype.config, { Controller: TimeOffCalendarEmployeeController, + Model: TimeOffCalendarModel, }), }); diff --git a/addons/hr_holidays/static/src/js/time_off_calendar/time_off_calendar_model.js b/addons/hr_holidays/static/src/js/time_off_calendar/time_off_calendar_model.js new file mode 100644 index 00000000000..2d4d5ab338a --- /dev/null +++ b/addons/hr_holidays/static/src/js/time_off_calendar/time_off_calendar_model.js @@ -0,0 +1,11 @@ +/** @odoo-module */ + +import CalendarModel from "web.CalendarModel"; + + +export const TimeOffCalendarModel = CalendarModel.extend({ + _getFilterDomain: function() { + const company_domain = [['user_id.company_id', 'in', this.data.context.allowed_company_ids]]; + return this._super().concat(company_domain); + }, +}); diff --git a/addons/hr_holidays/static/src/js/time_off_calendar/time_off_calendar_views.js b/addons/hr_holidays/static/src/js/time_off_calendar/time_off_calendar_views.js index 19db972c1f3..2777e808e77 100644 --- a/addons/hr_holidays/static/src/js/time_off_calendar/time_off_calendar_views.js +++ b/addons/hr_holidays/static/src/js/time_off_calendar/time_off_calendar_views.js @@ -3,6 +3,7 @@ import CalendarView from "web.CalendarView"; import config from 'web.config'; import { TimeOffCalendarController } from "./time_off_calendar_controller"; +import { TimeOffCalendarModel } from "./time_off_calendar_model"; import { TimeOffCalendarRenderer } from "./time_off_calendar_renderer"; import { TimeOffPopoverRenderer } from "./time_off_popover_renderer"; import viewRegistry from 'web.view_registry'; @@ -10,6 +11,7 @@ import viewRegistry from 'web.view_registry'; export const TimeOffCalendarView = CalendarView.extend({ config: Object.assign({}, CalendarView.prototype.config, { Controller: TimeOffCalendarController, + Model: TimeOffCalendarModel, Renderer: TimeOffCalendarRenderer, }),