Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][ADD] hr_timesheet_overtime_rate: Add hours_worked field #41

Open
wants to merge 8 commits into
base: 16.0
Choose a base branch
from
26 changes: 0 additions & 26 deletions hr_timesheet_overtime/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,6 @@ Computes overtime hours according to employee's contracts.
.. contents::
:local:

Known issues / Roadmap
======================

There is a problem with the way this module handles rates for overtime. If the
rate ever changes, things will start to break.

At time of writing (2024-06-28), the way a rate is computed for a date is by
looking _exclusively_ at the corresponding day of the week. This should be more
robust.

Furthermore, when inserting hours worked, the actual hours worked get lost. You
(try to) write a value to ``unit_amount``, but an augmented value gets written
to the field instead. This is rather ugly.

We can improve this by relying on the computation of ``unit_amount`` in Odoo
≥16: create a new field ``hours_worked``, which contains the actual hours worked
sans rate. Then, compute ``unit_amount`` from ``hours_worked`` (in a more robust
fashion than is presently the case). In the interface, show ``hours_worked``
more prominently than ``unit_amount`` as the main editable field.

To make this module subsequently compatible with ``hr_timesheet_begin_end``,
``hours_worked`` must be computed from ``time_stop`` and ``time_start``, and
``unit_amount`` must use this module's computation method instead of
``hr_timesheet_begin_end``'s. The compatibility layer should go into its own
module.

Bug Tracker
===========

Expand Down
4 changes: 1 addition & 3 deletions hr_timesheet_overtime/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Timesheet/Contract - Overtime",
"version": "16.0.2.1.0",
"version": "16.0.3.0.0",
"category": "Human Resources",
"summary": "Overtime Calculation",
"author": "Coop IT Easy SC, Odoo Community Association (OCA)",
Expand All @@ -15,9 +15,7 @@
"resource_work_time_from_contracts",
],
"data": [
"security/ir.model.access.csv",
"views/hr_employee_view.xml",
"views/resource_view.xml",
"views/hr_timesheet_sheet_view.xml",
],
"demo": [
Expand Down
3 changes: 0 additions & 3 deletions hr_timesheet_overtime/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
from . import account_analytic_line
from . import hr_employee
from . import hr_timesheet_sheet
from . import resource_overtime
from . import resource_overtime_rate
49 changes: 0 additions & 49 deletions hr_timesheet_overtime/models/account_analytic_line.py

This file was deleted.

22 changes: 0 additions & 22 deletions hr_timesheet_overtime/readme/ROADMAP.rst

This file was deleted.

55 changes: 17 additions & 38 deletions hr_timesheet_overtime/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -366,63 +367,41 @@ <h1 class="title">Timesheet/Contract - Overtime</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f303e3ad17e5d88c4ddf2a1baf816f420994d594a04db998c4fd2c1e9f1b2131
!! source digest: sha256:bde6f189b3da65ae6a23a4337c16402e0a29f4ebbb8dd39431f53c37a66249ef
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/coopiteasy/cie-timesheet/tree/16.0/hr_timesheet_overtime"><img alt="coopiteasy/cie-timesheet" src="https://img.shields.io/badge/github-coopiteasy%2Fcie--timesheet-lightgray.png?logo=github" /></a></p>
<p>Computes overtime hours according to employee’s contracts.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-1">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
<li><a class="reference internal" href="#other-credits" id="toc-entry-6">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-4">Contributors</a></li>
<li><a class="reference internal" href="#other-credits" id="toc-entry-5">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#toc-entry-1">Known issues / Roadmap</a></h1>
<p>There is a problem with the way this module handles rates for overtime. If the
rate ever changes, things will start to break.</p>
<p>At time of writing (2024-06-28), the way a rate is computed for a date is by
looking _exclusively_ at the corresponding day of the week. This should be more
robust.</p>
<p>Furthermore, when inserting hours worked, the actual hours worked get lost. You
(try to) write a value to <tt class="docutils literal">unit_amount</tt>, but an augmented value gets written
to the field instead. This is rather ugly.</p>
<p>We can improve this by relying on the computation of <tt class="docutils literal">unit_amount</tt> in Odoo
≥16: create a new field <tt class="docutils literal">hours_worked</tt>, which contains the actual hours worked
sans rate. Then, compute <tt class="docutils literal">unit_amount</tt> from <tt class="docutils literal">hours_worked</tt> (in a more robust
fashion than is presently the case). In the interface, show <tt class="docutils literal">hours_worked</tt>
more prominently than <tt class="docutils literal">unit_amount</tt> as the main editable field.</p>
<p>To make this module subsequently compatible with <tt class="docutils literal">hr_timesheet_begin_end</tt>,
<tt class="docutils literal">hours_worked</tt> must be computed from <tt class="docutils literal">time_stop</tt> and <tt class="docutils literal">time_start</tt>, and
<tt class="docutils literal">unit_amount</tt> must use this module’s computation method instead of
<tt class="docutils literal">hr_timesheet_begin_end</tt>’s. The compatibility layer should go into its own
module.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/coopiteasy/cie-timesheet/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/coopiteasy/cie-timesheet/issues/new?body=module:%20hr_timesheet_overtime%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<ul class="simple">
<li>Coop IT Easy SC</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://coopiteasy.be">Coop IT Easy SC</a>:<ul>
<li>Vincent Van Rossem</li>
Expand All @@ -434,12 +413,12 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#toc-entry-6">Other credits</a></h2>
<h2><a class="toc-backref" href="#toc-entry-5">Other credits</a></h2>
<p>The development of this module has been paid for by
<a class="reference external" href="https://www.provelo.org/">Pro Velo</a>.</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/coopiteasy/cie-timesheet/tree/16.0/hr_timesheet_overtime">coopiteasy/cie-timesheet</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
Expand Down
17 changes: 0 additions & 17 deletions hr_timesheet_overtime/views/hr_timesheet_sheet_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
decoration-info="total_overtime &gt;= 0"
/>
</xpath>

</field>
</record>

Expand Down Expand Up @@ -96,20 +95,4 @@
</field>
</record>

<menuitem
name="Overtime"
id="menu_hr_timesheet_overtime"
sequence="99"
parent="hr_timesheet.timesheet_menu_root"
/>

<menuitem
name="Overtime Rate"
id="menu_hr_timesheet_overtime_rate"
sequence="100"
parent="menu_hr_timesheet_overtime"
groups="hr.group_hr_manager"
action="action_resource_overtime_form"
/>

</odoo>
91 changes: 91 additions & 0 deletions hr_timesheet_overtime_rate/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
=============
Overtime Rate
=============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:36d3b7bc33750523cfa2cc468002678f8db599e083759ba12ede988ee84d6431
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-coopiteasy%2Fcie--timesheet-lightgray.png?logo=github
:target: https://github.com/coopiteasy/cie-timesheet/tree/16.0/hr_timesheet_overtime_rate
:alt: coopiteasy/cie-timesheet

|badge1| |badge2| |badge3|

Define an extra rate for working certain days.

**Table of contents**

.. contents::
:local:

Known issues / Roadmap
======================

There is a problem with the way this module handles rates for overtime. If the
rate ever changes, things will start to break.

At time of writing (2024-06-28), the way a rate is computed for a date is by
looking _exclusively_ at the corresponding day of the week. This should be more
robust.

Because ``unit_amount`` is computed from ``hours_worked``, this module is not
compatible with ``hr_timesheet_begin_end``.To make this module subsequently
compatible with ``hr_timesheet_begin_end``, ``hours_worked`` must be computed
from ``time_stop`` and ``time_start``, and ``unit_amount`` must use this
module's computation method instead of ``hr_timesheet_begin_end``'s. The
compatibility layer should go into its own module.

Furthermore, the summary view of timesheet sheets are set read-only in this
module. Because of programming complexities, it is not easy to change this view
to use ``hours_worked`` instead of ``unit_amount``.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/coopiteasy/cie-timesheet/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/coopiteasy/cie-timesheet/issues/new?body=module:%20hr_timesheet_overtime_rate%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Coop IT Easy SC

Contributors
~~~~~~~~~~~~

* `Coop IT Easy SC <https://coopiteasy.be>`_:

* Carmen Bianca BAKKER

Maintainers
~~~~~~~~~~~

.. |maintainer-carmenbianca| image:: https://github.com/carmenbianca.png?size=40px
:target: https://github.com/carmenbianca
:alt: carmenbianca

Current maintainer:

|maintainer-carmenbianca|

This module is part of the `coopiteasy/cie-timesheet <https://github.com/coopiteasy/cie-timesheet/tree/16.0/hr_timesheet_overtime_rate>`_ project on GitHub.

You are welcome to contribute.
5 changes: 5 additions & 0 deletions hr_timesheet_overtime_rate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from . import models
Loading
Loading