Odoo Help

0

Override timesheet.js (v9)

By
Philipp Johne
on 1/31/16, 12:54 PM 979 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

--Pawan--
1422
| 4 4 5
Hyderabad, India
--Pawan--


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

--Axel Mendoza--
11611
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

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: 979 times
Last updated: 8/8/16, 5:42 AM