[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.
This commit is contained in:
Anshuman Sharma
2018-07-26 16:20:42 +02:00
committed by Thibault Delavallée
parent d5dc1536dd
commit 0bf4986cf6
2 changed files with 2 additions and 6 deletions
@@ -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}));
});
@@ -47,7 +47,7 @@
<h3 class="mt0 mb0 text-muted">Click to <b t-if="checked_in">check out</b><b t-if="!checked_in">check in</b></h3>
</t>
<t t-else="">
Error : Could not find employee linked to user.
Warning : Your user should be linked to an employee to use attendance. Please contact your administrator.
</t>
</div>
</div>