Debian Codegraph @

addons/hr_timesheet/static/src/views/timesheet_calendar/timesheet_calendar_model.js

raw
1 import { _t } from "@web/core/l10n/translation";
2
3 import { TimesheetCalendarMyTimesheetsModel } from "../timesheet_calendar_my_timesheets/timesheet_calendar_my_timesheets_model";
4
5 export class TimesheetCalendarModel extends TimesheetCalendarMyTimesheetsModel {
6 setup(params, services) {
7 super.setup(...arguments);
8 this.notification = services.notification;
9 }
10
11 async multiCreateRecords(multiCreateData, dates) {
12 const [section] = this.filterSections;
13 if (section.filters.filter((filter) => filter.active).length === 0) {
14 this.notification.add(_t("Choose an employee to create their timesheet."), {
15 type: "danger",
16 });
17 return;
18 }
19 return await super.multiCreateRecords(multiCreateData, dates);
20 }
21 }