diff --git a/addons/hr_attendance/models/hr_employee.py b/addons/hr_attendance/models/hr_employee.py index e0cec9681bc..83e44105c00 100644 --- a/addons/hr_attendance/models/hr_employee.py +++ b/addons/hr_attendance/models/hr_employee.py @@ -90,6 +90,7 @@ class HrEmployee(models.Model): action_message = self.env.ref('hr_attendance.hr_attendance_action_greeting_message').read()[0] action_message['previous_attendance_change_date'] = self.last_attendance_id and (self.last_attendance_id.check_out or self.last_attendance_id.check_in) or False action_message['employee_name'] = self.name + action_message['barcode'] = self.barcode action_message['next_action'] = next_action if self.user_id: diff --git a/addons/hr_attendance/static/src/js/greeting_message.js b/addons/hr_attendance/static/src/js/greeting_message.js index 16f1fc0c935..ac5762d7788 100644 --- a/addons/hr_attendance/static/src/js/greeting_message.js +++ b/addons/hr_attendance/static/src/js/greeting_message.js @@ -51,22 +51,7 @@ var GreetingMessage = AbstractAction.extend({ this.attendance.check_in_time = this.attendance.check_in && this.attendance.check_in.format(this.format_time); this.attendance.check_out_time = this.attendance.check_out && this.attendance.check_out.format(this.format_time); this.employee_name = action.employee_name; - }, - - willStart: function() { - var self = this; - var def; - if (this.attendance && this.attendance.employee_id) { - def = this._rpc({ - model: 'hr.employee', - method: 'read', - args: [this.attendance.employee_id[0], ['barcode']], - }) - .then(function (employee) { - self.attendanceBarcode = employee[0].barcode; - }); - } - return $.when(this._super.apply(this, arguments), def); + this.attendanceBarcode = action.barcode; }, start: function() { @@ -167,7 +152,10 @@ var GreetingMessage = AbstractAction.extend({ self.do_action(result.action); } else if (result.warning) { self.do_warn(result.warning); + setTimeout( function() { self.do_action(self.next_action, {clear_breadcrumbs: true}); }, 5000); } + }, function () { + setTimeout( function() { self.do_action(self.next_action, {clear_breadcrumbs: true}); }, 5000); }); } }, diff --git a/addons/hr_attendance/static/src/js/kiosk_mode.js b/addons/hr_attendance/static/src/js/kiosk_mode.js index ead0c1cec2c..07b03aa8b97 100644 --- a/addons/hr_attendance/static/src/js/kiosk_mode.js +++ b/addons/hr_attendance/static/src/js/kiosk_mode.js @@ -47,7 +47,10 @@ var KioskMode = AbstractAction.extend({ self.do_action(result.action); } else if (result.warning) { self.do_warn(result.warning); + core.bus.on('barcode_scanned', self, self._onBarcodeScanned); } + }, function () { + core.bus.on('barcode_scanned', self, self._onBarcodeScanned); }); }, diff --git a/addons/hr_attendance/static/tests/hr_attendance_tests.js b/addons/hr_attendance/static/tests/hr_attendance_tests.js index 227d2af36b1..ee582a5d7ad 100644 --- a/addons/hr_attendance/static/tests/hr_attendance_tests.js +++ b/addons/hr_attendance/static/tests/hr_attendance_tests.js @@ -120,6 +120,7 @@ QUnit.module('HR Attendance', { employee_id: [barcode], }, next_action: "hr_attendance.hr_attendance_action_kiosk_mode", + barcode: barcode, } var clientAction = new GreetingMessage(null, action); testUtils.addMockEnvironment(clientAction, {