Skip to Content
Menu
This question has been flagged
1 Reply
2338 Views

I am delevoping a module which depend on Attendances(the Technical Name is 'hr_attendance').

I want to override the JaveScript mudule 'hr_attendance.employee_kanban_view_handler' and type the code as below:

odoo.define('hr_attendance_my.employee_kanban_view_handler', function(require) {

"use strict";

var KanbanRecord = require('hr_attendance.employee_kanban_view_handler');

KanbanRecord.include({

_openRecord: function () {

if (this.modelName === 'hr.employee' && this.$el.parents('.o_hr_employee_attendance_kanban').length) {

var action = {

type: 'ir.actions.client',

name: 'Confirm',

tag: 'hr_attendance_kiosk_confirm',

employee_id: this.record.id.raw_value,

employee_name: this.record.name.raw_value,

employee_state: this.record.attendance_state.raw_value,

employee_image: this.record.image, //the insert line.

};

this.do_action(action);

} else {

this._super.apply(this, arguments);

}

}

});

});

So that, I can pass the image of the employee to the JavaScript medule 'hr_attendance.kiosk_confirm'.

However, the broswer catch a Failed modules:

["hr_attendance_my.employee_kanban_view_handler"]

So, anyone can give me something advice for this issue?

ZOOU Qinn

Avatar
Discard
Best Answer

This will override it and will add the image parameter.

odoo.define('custom_module.employee_kanban_view_handler', function(require) {

"use strict";

var KanbanRecord = require('web_kanban.Record');

KanbanRecord.include({

on_card_clicked: function() {

if (this.model === 'hr.employee' && this.$el.parents('.o_hr_employee_attendance_kanban').length) {

// needed to diffentiate : check in/out kanban view of employees <-> standard employee kanban view

var action = {

type: 'ir.actions.client',

name: 'Confirm',

tag: 'hr_attendance_kiosk_confirm',

employee_id: this.record.id.raw_value,

employee_name: this.record.name.raw_value,

employee_state: this.record.attendance_state.raw_value,

employee_image: this.record.image_medium.value,

};

this.do_action(action);

} else {

this._super.apply(this, arguments);

}

}

});

});

Avatar
Discard
Related Posts Replies Views Activity
1
Dec 24
114
2
Nov 24
82
1
Oct 24
256
0
Sep 24
212
2
Sep 24
646