Skip to content

Commit

Permalink
[FIX] hr_attendance: use correct company in Kiosk mode
Browse files Browse the repository at this point in the history
A wrong company was used in the Kiosk mode, preventing users to check in
/ out.

closes odoo#80013

Taskid: 2691031
X-original-commit: ed3003c
Signed-off-by: Kevin Baptiste <[email protected]>
  • Loading branch information
Kevin Baptiste committed Nov 18, 2021
1 parent 4fd5cd6 commit 2cc5615
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions addons/hr_attendance/static/src/js/kiosk_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ var KioskMode = AbstractAction.extend({
var self = this;
core.bus.on('barcode_scanned', this, this._onBarcodeScanned);
self.session = Session;
const company_id = this.session.user_context.allowed_company_ids[0];
var def = this._rpc({
model: 'res.company',
method: 'search_read',
args: [[['id', '=', this.session.company_id]], ['name']],
args: [[['id', '=', company_id]], ['name']],
})
.then(function (companies){
self.company_name = companies[0].name;
self.company_image_url = self.session.url('/web/image', {model: 'res.company', id: self.session.company_id, field: 'logo',});
self.company_image_url = self.session.url('/web/image', {model: 'res.company', id: company_id, field: 'logo',});
self.$el.html(QWeb.render("HrAttendanceKioskMode", {widget: self}));
self.start_clock();
});
Expand Down
4 changes: 3 additions & 1 deletion addons/hr_attendance/static/tests/hr_attendance_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ QUnit.module('HR Attendance', {
data: this.data,
session: {
uid: 1,
company_id: 1,
user_context: {
allowed_company_ids: [1],
}
},
mockRPC: function(route, args) {
if (args.method === 'attendance_scan' && args.model === 'hr.employee') {
Expand Down

0 comments on commit 2cc5615

Please sign in to comment.