Odoo Help

0

Override timesheet.js (v9)

By
Philipp Johne
on 1/31/16, 12:54 PM 1,144 views

I want to override some methods of the WeeklyTimesheet widget. Can someone please help me with the necessary javascript to override it from a custom module (v9)? 

The problem seems to be which object to inherit, since the error message is: "'undefined' is not an object".

Here is the relevant line from timesheet.js that creates a 'FormWidget':

./hr_timesheet_sheet/static/src/js/timesheet.js:15:var WeeklyTimesheet = form_common.FormWidget.extend(form_common.ReinitializeWidgetMixin, {

This, unfortunately, does not work:

instance.hr_timesheet_sheet.WeeklyTimesheet.include({

0
Pawan
On 8/8/16, 5:42 AM

Phillipe,

Hope you have got the solution, but for those who are still seeking for it:.

use core.form_custom_registry to get the weekly_timesheet class

var timesheet = core.form_custom_registry.get('weekly_timesheet');

and then , override it using,

timesheet.include({

//Your code here...

});


0
Axel Mendoza
On 1/31/16, 2:33 PM

@Philipp Johne

The include method doesn't return anything so for change an existing class you could do it simply like:
instance.hr_timesheet_sheet.WeeklyTimesheet.include({
...

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 1/31/16, 12:54 PM
Seen: 1144 times
Last updated: 8/8/16, 5:42 AM