From 749a73ecfff358e61b510c01cd3425e1893b5bae Mon Sep 17 00:00:00 2001 From: Kevin Baptiste Date: Thu, 13 Apr 2023 07:45:07 +0000 Subject: [PATCH] [FIX] hr_attendance: allow kiosk to use My Attendances The Check In / Check Out menu would show that the user is not linked to an employee because it was trying to read on `hr.employee` and not `hr.employee.public`. opw-3268217 closes odoo/odoo#118498 X-original-commit: 233a185362f2bc3243187f1f0b740ee5b154f039 Signed-off-by: Kevin Baptiste --- .../static/src/client_action/my_attendances/my_attendances.js | 2 +- addons/hr_attendance/static/tests/client_action_tests.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/hr_attendance/static/src/client_action/my_attendances/my_attendances.js b/addons/hr_attendance/static/src/client_action/my_attendances/my_attendances.js index c4cddace6fc..2281c905d44 100644 --- a/addons/hr_attendance/static/src/client_action/my_attendances/my_attendances.js +++ b/addons/hr_attendance/static/src/client_action/my_attendances/my_attendances.js @@ -20,7 +20,7 @@ export class MyAttendances extends Component { async onWillStart() { const result = await this.orm.searchRead( - "hr.employee", + "hr.employee.public", [["user_id", "=", this.user.userId]], ["attendance_state", "name", "hours_today"] ); diff --git a/addons/hr_attendance/static/tests/client_action_tests.js b/addons/hr_attendance/static/tests/client_action_tests.js index b3e249ab58b..be82803f6ff 100644 --- a/addons/hr_attendance/static/tests/client_action_tests.js +++ b/addons/hr_attendance/static/tests/client_action_tests.js @@ -17,7 +17,7 @@ QUnit.module("Client Actions", (hooks) => { // serverData = getActionManagerServerData(); serverData = { models: { - "hr.employee": { + "hr.employee.public": { fields: { name: { string: "Name", type: "char" }, attendance_state: { @@ -114,7 +114,7 @@ QUnit.module("Client Actions", (hooks) => { const mockRPC = async (route, args) => { if (args.method === "attendance_scan" && args.model === "hr.employee") { rpcCount++; - return serverData.models["hr.employee"].records.find((r) => r.id === args.args[0]); + return serverData.models["hr.employee.public"].records.find((r) => r.id === args.args[0]); } }; const webClient = await createWebClient({ serverData, mockRPC });