Skip to Content
Menu
This question has been flagged
2 Replies
3897 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({

Avatar
Discard
Best Answer

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...

});


Avatar
Discard
Best Answer

@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({
...

Avatar
Discard
Related Posts Replies Views Activity
1
Mar 22
5466
0
May 16
1934
2
Jul 24
1334
3
May 24
1242
0
May 24
507