| 1 |
import { calendarView } from '@web/views/calendar/calendar_view'; |
| 2 |
|
| 3 |
import { TimeOffCalendarController, TimeOffReportCalendarController } from './calendar_controller'; |
| 4 |
import { TimeOffCalendarModel } from './calendar_model'; |
| 5 |
import { TimeOffCalendarRenderer, TimeOffDashboardCalendarRenderer } from './calendar_renderer'; |
| 6 |
|
| 7 |
import { registry } from '@web/core/registry'; |
| 8 |
import { user } from "@web/core/user"; |
| 9 |
import { useService } from "@web/core/utils/hooks"; |
| 10 |
import { onWillStart } from "@odoo/owl"; |
| 11 |
|
| 12 |
class TimeOffCalendarControllerHrLeave extends TimeOffCalendarController { |
| 13 |
setup() { |
| 14 |
super.setup(); |
| 15 |
this.actionService = useService("action"); |
| 16 |
onWillStart(async () => { |
| 17 |
this.canCreateGroupTimeOff = await user.hasGroup("hr_holidays.group_hr_holidays_responsible"); |
| 18 |
}); |
| 19 |
} |
| 20 |
|
| 21 |
async onNewGroupTimeOff() { |
| 22 |
await this.actionService.doAction("hr_holidays.action_hr_leave_generate_multi_wizard"); |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
const TimeOffCalendarView = { |
| 27 |
...calendarView, |
| 28 |
|
| 29 |
Controller: TimeOffCalendarController, |
| 30 |
Renderer: TimeOffCalendarRenderer, |
| 31 |
Model: TimeOffCalendarModel, |
| 32 |
} |
| 33 |
|
| 34 |
const TimeOffCalendarHrLeaveView = { |
| 35 |
...TimeOffCalendarView, |
| 36 |
Controller: TimeOffCalendarControllerHrLeave, |
| 37 |
buttonTemplate: "hr_holidays.CalendarView.Buttons", |
| 38 |
} |
| 39 |
|
| 40 |
registry.category('views').add('time_off_calendar', TimeOffCalendarView); |
| 41 |
registry.category('views').add('time_off_calendar_hr_leave', TimeOffCalendarHrLeaveView); |
| 42 |
registry.category('views').add('time_off_calendar_dashboard', { |
| 43 |
...TimeOffCalendarView, |
| 44 |
Renderer: TimeOffDashboardCalendarRenderer, |
| 45 |
}); |
| 46 |
registry.category('views').add('time_off_report_calendar', { |
| 47 |
...TimeOffCalendarView, |
| 48 |
Controller: TimeOffReportCalendarController, |
| 49 |
}) |