From 0bf4986cf6b011b150bf6a6ee7f5994ddf2ae7b1 Mon Sep 17 00:00:00 2001 From: Anshuman Sharma Date: Wed, 13 Jun 2018 16:31:12 +0530 Subject: [PATCH] [FIX] hr_attendance: fix attendance check in/out layout issue when having no employee When user is not linked to any employee and get try to check in/out then user gets white screen. Instead correctly displays a warning message telling the user should have an employee. Screeshot: https://drive.google.com/file/d/1cX1NtCcELeTYgr0kK5cW4i5etyHtezAV/view This commit is related to task ID 1841522. Closes PR #25230. --- addons/hr_attendance/static/src/js/my_attendances.js | 6 +----- addons/hr_attendance/static/src/xml/attendance.xml | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/addons/hr_attendance/static/src/js/my_attendances.js b/addons/hr_attendance/static/src/js/my_attendances.js index 4a19b2b9b28..228f35c1813 100644 --- a/addons/hr_attendance/static/src/js/my_attendances.js +++ b/addons/hr_attendance/static/src/js/my_attendances.js @@ -25,11 +25,7 @@ var MyAttendances = AbstractAction.extend({ args: [[['user_id', '=', this.getSession().uid]], ['attendance_state', 'name']], }) .then(function (res) { - if (_.isEmpty(res) ) { - self.$('.o_hr_attendance_employee').append(_t("Error : Could not find employee linked to user")); - return; - } - self.employee = res[0]; + self.employee = res.length && res[0]; self.$el.html(QWeb.render("HrAttendanceMyMainMenu", {widget: self})); }); diff --git a/addons/hr_attendance/static/src/xml/attendance.xml b/addons/hr_attendance/static/src/xml/attendance.xml index e9de1799dce..264d13a4780 100644 --- a/addons/hr_attendance/static/src/xml/attendance.xml +++ b/addons/hr_attendance/static/src/xml/attendance.xml @@ -47,7 +47,7 @@

Click to check outcheck in

- Error : Could not find employee linked to user. + Warning : Your user should be linked to an employee to use attendance. Please contact your administrator.