DEV Community

Damien Crier for Camptocamp Business Solutions

Posted on

Odoo: Customizing the values when timesheeting

Your company uses Odoo >= v14 to manage timesheet and has a default setting to timesheet in Days?
Timesheet config settings

By default, the only values you can select are:

  • 0.0
  • 0.5
  • 1.0

TS range selectable

Fortunately, the widget supports customization!

In the view definition, you can add an option to define a new range usable for the widget for this view. With the following code, you will be able to select any tenth of a day:

options="{'range':[0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]}"
Enter fullscreen mode Exit fullscreen mode

Demonstration:

In the tree view of the timesheets, change the definition of the field unit_amount by:

<field name="unit_amount"
    optional="show" 
    widget="timesheet_uom" 
    sum="Total" 
    decoration-danger="unit_amount > 24" 
    options="{'range':[0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]}"
/>
Enter fullscreen mode Exit fullscreen mode

And here is the result:

TS range selectable customized

Top comments (0)