DEV Community

Damien Crier for Camptocamp Business Solutions

Posted on

7 2

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

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs