[FIX] hr_attendance: remove flickering in client actions

This commit is contained in:
Aaron Bohy
2017-12-15 13:10:49 +01:00
parent 253b4398bf
commit 9bc465988c
2 changed files with 6 additions and 6 deletions
@@ -16,10 +16,10 @@ var KioskMode = Widget.extend({
var self = this;
core.bus.on('barcode_scanned', this, this._onBarcodeScanned);
self.session = Session;
this._rpc({
var def = this._rpc({
model: 'res.company',
method: 'search_read',
args: [[['id', '=', self.session.company_id]], ['name']],
args: [[['id', '=', this.session.company_id]], ['name']],
})
.then(function (companies){
self.company_name = companies[0].name;
@@ -27,7 +27,7 @@ var KioskMode = Widget.extend({
self.$el.html(QWeb.render("HrAttendanceKioskMode", {widget: self}));
self.start_clock();
});
return self._super.apply(this, arguments);
return $.when(def, this._super.apply(this, arguments));
},
_onBarcodeScanned: function(barcode) {
@@ -19,10 +19,10 @@ var MyAttendances = Widget.extend({
start: function () {
var self = this;
this._rpc({
var def = this._rpc({
model: 'hr.employee',
method: 'search_read',
args: [[['user_id', '=', self.getSession().uid]], ['attendance_state', 'name']],
args: [[['user_id', '=', this.getSession().uid]], ['attendance_state', 'name']],
})
.then(function (res) {
if (_.isEmpty(res) ) {
@@ -33,7 +33,7 @@ var MyAttendances = Widget.extend({
self.$el.html(QWeb.render("HrAttendanceMyMainMenu", {widget: self}));
});
return this._super.apply(this, arguments);
return $.when(def, this._super.apply(this, arguments));
},
update_attendance: function () {