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

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more