[FIX] hr_attendance: do not show slider widget if user is not an employee
bzr revid: chs@openerp.com-20121214155430-h6u3l9jlutm1dclw
This commit is contained in:
commit
c4e89c651a
|
@ -60,7 +60,7 @@ openerp.hr_attendance = function (instance) {
|
||||||
return employee.read_slice(['id', 'name', 'state', 'last_sign', 'attendance_access']).then(function (res) {
|
return employee.read_slice(['id', 'name', 'state', 'last_sign', 'attendance_access']).then(function (res) {
|
||||||
if (_.isEmpty(res) )
|
if (_.isEmpty(res) )
|
||||||
return;
|
return;
|
||||||
if (res[0].attendance_access == false){
|
if (res[0].attendance_access === false){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.$el.show();
|
self.$el.show();
|
||||||
|
@ -75,13 +75,21 @@ openerp.hr_attendance = function (instance) {
|
||||||
do_update: function () {
|
do_update: function () {
|
||||||
this._super();
|
this._super();
|
||||||
var self = this;
|
var self = this;
|
||||||
this.update_promise = this.update_promise.done(function () {
|
this.update_promise.done(function () {
|
||||||
if (self.attendanceslider)
|
if (!_.isUndefined(self.attendanceslider)) {
|
||||||
return;
|
return;
|
||||||
self.attendanceslider = new instance.hr_attendance.AttendanceSlider(self);
|
}
|
||||||
|
// check current user is an employee
|
||||||
self.attendanceslider.prependTo(instance.webclient.$('.oe_systray'));
|
var Users = new instance.web.Model('res.users');
|
||||||
|
Users.call('has_group', ['base.group_user']).done(function(is_employee) {
|
||||||
|
if (is_employee) {
|
||||||
|
self.attendanceslider = new instance.hr_attendance.AttendanceSlider(self);
|
||||||
|
self.attendanceslider.prependTo(instance.webclient.$('.oe_systray'));
|
||||||
|
} else {
|
||||||
|
self.attendanceslider = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
Loading…
Reference in New Issue