[FIX] *: correctly use session

Widget has no attribute `session` since the new views.

One should either use `getSession()` or require `web.session` (both
cases are correct).
This commit is contained in:
Martin Geubelle
2017-09-27 11:04:08 +02:00
parent a3828dfed3
commit df04910d2a
5 changed files with 6 additions and 6 deletions
@@ -23,7 +23,7 @@ var GreetingMessage = Widget.extend({
// to the (likely) appropriate menu, according to the user access rights
if(!action.attendance) {
this.activeBarcode = false;
this.session.user_has_group('hr_attendance.group_hr_attendance_user').then(function(has_group) {
this.getSession().user_has_group('hr_attendance.group_hr_attendance_user').then(function(has_group) {
if(has_group) {
self.next_action = 'hr_attendance.hr_attendance_action_kiosk_mode';
} else {
@@ -67,7 +67,7 @@ var KioskConfirm = Widget.extend({
start: function () {
var self = this;
self.session.user_has_group('hr_attendance.group_hr_attendance_use_pin').then(function(has_group){
this.getSession().user_has_group('hr_attendance.group_hr_attendance_use_pin').then(function(has_group){
self.use_pin = has_group;
self.$el.html(QWeb.render("HrAttendanceKioskConfirm", {widget: self}));
self.start_clock();
+1 -1
View File
@@ -572,7 +572,7 @@ var Chrome = PosBaseWidget.extend({
this.started = new $.Deferred(); // resolves when DOM is online
this.ready = new $.Deferred(); // resolves when the whole GUI has been loaded
this.pos = new models.PosModel(this.session,{chrome:this});
this.pos = new models.PosModel(this.getSession(), {chrome:this});
this.gui = new gui.Gui({pos: this.pos, chrome: this});
this.chrome = this; // So that chrome's childs have chrome set automatically
this.pos.gui = this.gui;
@@ -237,7 +237,7 @@ var AbstractWebClient = Widget.extend(mixins.ServiceProvider, {
},
do_reload: function () {
var self = this;
return this.session.session_reload().then(function () {
return session.session_reload().then(function () {
session.load_modules(true).then(
self.menu.proxy('do_reload'));
});
@@ -895,14 +895,14 @@ var ActionManager = Widget.extend({
action: JSON.stringify(action),
token: new Date().getTime()
};
var url = self.session.url('/web/report', params);
var url = session.url('/web/report', params);
framework.unblockUI();
$('<a href="'+url+'" target="_blank"></a>')[0].click();
return;
}
var c = crash_manager;
return $.Deferred(function (d) {
self.session.get_file({
session.get_file({
url: '/web/report',
data: {action: JSON.stringify(action)},
complete: framework.unblockUI,