Skip to content

Commit 89de567

Browse files
[ADD] hr_timesheet_encode_day_float: add new module
1 parent 8910c51 commit 89de567

14 files changed

Lines changed: 669 additions & 0 deletions

File tree

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
==========================
2+
Timesheet Encode Day Float
3+
==========================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:7acd5a1f872733b15e61a4fb6badf286267a209a8571e829fbe2bbad5f83aeac
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Ftimesheet-lightgray.png?logo=github
20+
:target: https://github.com/OCA/timesheet/tree/18.0/hr_timesheet_encode_day_float
21+
:alt: OCA/timesheet
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/timesheet-18-0/timesheet-18-0-hr_timesheet_encode_day_float
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/timesheet&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module changes the timesheet day encoding widget from a half-day
32+
toggle (``0`` / ``0.5`` / ``1``) to a free decimal float field.
33+
34+
Users can enter any fraction of a day (for example ``0.2``, ``0.75`` or
35+
``3``) while keeping the standard Days unit of measure and hour
36+
conversion from ``hr_timesheet``.
37+
38+
**Table of contents**
39+
40+
.. contents::
41+
:local:
42+
43+
Usage
44+
=====
45+
46+
To encode timesheets with free day decimals:
47+
48+
1. Go to *Timesheets > Configuration > Settings*.
49+
2. Under *Time Encoding*, select *Days*.
50+
3. Save the settings.
51+
4. On timesheets and allocated time, enter day values as decimals (for
52+
example ``0.2`` for one fifth of a day, or ``3`` for three days).
53+
54+
Bug Tracker
55+
===========
56+
57+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/timesheet/issues>`_.
58+
In case of trouble, please check there if your issue has already been reported.
59+
If you spotted it first, help us to smash it by providing a detailed and welcomed
60+
`feedback <https://github.com/OCA/timesheet/issues/new?body=module:%20hr_timesheet_encode_day_float%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
61+
62+
Do not contact contributors directly about support or help with technical issues.
63+
64+
Credits
65+
=======
66+
67+
Authors
68+
-------
69+
70+
* Escodoo
71+
72+
Contributors
73+
------------
74+
75+
- `Escodoo <https://www.escodoo.com.br>`__:
76+
77+
- Marcel Savegnago <marcel.savegnago@escodoo.com.br>
78+
79+
Maintainers
80+
-----------
81+
82+
This module is maintained by the OCA.
83+
84+
.. image:: https://odoo-community.org/logo.png
85+
:alt: Odoo Community Association
86+
:target: https://odoo-community.org
87+
88+
OCA, or the Odoo Community Association, is a nonprofit organization whose
89+
mission is to support the collaborative development of Odoo features and
90+
promote its widespread use.
91+
92+
.. |maintainer-marcelsavegnago| image:: https://github.com/marcelsavegnago.png?size=40px
93+
:target: https://github.com/marcelsavegnago
94+
:alt: marcelsavegnago
95+
96+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
97+
98+
|maintainer-marcelsavegnago|
99+
100+
This module is part of the `OCA/timesheet <https://github.com/OCA/timesheet/tree/18.0/hr_timesheet_encode_day_float>`_ project on GitHub.
101+
102+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import models
2+
from .hooks import uninstall_hook
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2026 Escodoo
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Timesheet Encode Day Float",
6+
"version": "18.0.1.0.0",
7+
"summary": "Encode timesheets in days with free decimal input",
8+
"category": "Services/Timesheets",
9+
"license": "AGPL-3",
10+
"website": "https://github.com/OCA/timesheet",
11+
"author": "Escodoo, Odoo Community Association (OCA)",
12+
"development_status": "Beta",
13+
"maintainers": ["marcelsavegnago"],
14+
"depends": ["hr_timesheet"],
15+
"data": [
16+
"data/uom_data.xml",
17+
],
18+
"uninstall_hook": "uninstall_hook",
19+
"installable": True,
20+
"application": False,
21+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo>
3+
<!-- Allow free decimal day input instead of the 0 / 0.5 / 1 toggle. -->
4+
<record id="uom.product_uom_day" model="uom.uom">
5+
<field name="timesheet_widget">float_factor</field>
6+
</record>
7+
</odoo>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright 2026 - TODAY, Marcel Savegnago <marcel.savegnago@escodoo.com.br>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
5+
def uninstall_hook(env):
6+
"""Restore the standard day timesheet widget on module uninstall."""
7+
uom_day = env.ref("uom.product_uom_day", raise_if_not_found=False)
8+
if uom_day and uom_day.timesheet_widget != "float_toggle":
9+
uom_day.timesheet_widget = "float_toggle"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import res_config_settings
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2026 - TODAY, Marcel Savegnago <marcel.savegnago@escodoo.com.br>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class ResConfigSettings(models.TransientModel):
8+
_inherit = "res.config.settings"
9+
10+
timesheet_encode_method = fields.Selection(
11+
selection_add=[("days", "Days")],
12+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- [Escodoo](https://www.escodoo.com.br):
2+
- Marcel Savegnago \<marcel.savegnago@escodoo.com.br\>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
This module changes the timesheet day encoding widget from a half-day
2+
toggle (`0` / `0.5` / `1`) to a free decimal float field.
3+
4+
Users can enter any fraction of a day (for example `0.2`, `0.75` or `3`)
5+
while keeping the standard Days unit of measure and hour conversion from
6+
`hr_timesheet`.

0 commit comments

Comments
 (0)