Hello Community , I want to inherit timesheet.js of the hr_timesheet_sheet , i want to add some function ? how to inherit this file ?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
First, you define a template in your module to add your js assets located in static/src/js:
<template id="assets_backend" name="newmodule_hr_timesheet_sheet assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/newmodule_hr_timesheet_sheet/static/src/js/timesheet.js"></script>
</xpath>
</template>
Then, in your module's new js file, you extend the widget from hr_timesheet_sheet like this:
odoo.define('newmodule_hr_timesheet_sheet.sheet', function (require){
"use strict";
// require original module JS
var timesheet = require('hr_timesheet_sheet.sheet');
// Extend widget
timesheet.WeeklyTimesheet.include({
....
your code to override here
....
});
}
would that completely override WeeklyTimesheet?
I'm trying to change a value in a js file without simply replacing the whole function. More specificaly, I'm trying to modify the calendar module so that "everybody's calendar" would be set to 'true'. I've only managed to do so by editing the source code, but this is rather ugly.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up