| 1 | import { user } from "@web/core/user"; |
| 2 | import { useService } from "@web/core/utils/hooks"; |
| 3 | |
| 4 | import { Component, onWillStart, useState } from "@odoo/owl"; |
| 5 | |
| 6 | export class AttendanceActionHelper extends Component { |
| 7 | static template = "hr_attendance.AttendanceActionHelper"; |
| 8 | static props = ["noContentHelp"]; |
| 9 | setup() { |
| 10 | this.orm = useService("orm"); |
| 11 | this.actionService = useService("action"); |
| 12 | this.state = useState({ |
| 13 | hasDemoData: false, |
| 14 | }); |
| 15 | onWillStart(async () => { |
| 16 | this.isHrUser = await user.hasGroup("hr.group_hr_user"); |
| 17 | this.hasAttendanceRight = await user.hasGroup("hr_attendance.group_hr_attendance_user"); |
| 18 | if (this.hasAttendanceRight && this.isHrUser){ |
| 19 | this.state.hasDemoData = await this.orm.call("hr.attendance", "has_demo_data", []); |
| 20 | } |
| 21 | }); |
| 22 | } |
| 23 | |
| 24 | loadAttendanceScenario() { |
| 25 | this.actionService.doAction("hr_attendance.action_load_demo_data"); |
| 26 | } |
| 27 | |
| 28 | LoadTryKiosk() { |
| 29 | this.actionService.doAction("hr_attendance.action_try_kiosk"); |
| 30 | } |
| 31 | }; |