Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions hr_timesheet_sheet_tier_validation/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
==================================
HR Timesheet Sheet Tier Validation
==================================

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

.. |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-OCA%2Ftimesheet-lightgray.png?logo=github
:target: https://github.com/OCA/timesheet/tree/18.0/hr_timesheet_sheet_tier_validation
:alt: OCA/timesheet
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/timesheet-18-0/timesheet-18-0-hr_timesheet_sheet_tier_validation
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/timesheet&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Extends the HR Timesheet Sheet module to support a multi-level tier
validation (approval) process. Approvers can be configured per tier
definition. The timesheet sheet must pass all configured tiers before
reaching the **Approved** state.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/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/OCA/timesheet/issues/new?body=module:%20hr_timesheet_sheet_tier_validation%0Aversion:%2018.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
-------

* Ecosoft

Contributors
------------

- `Ecosoft <https://ecosoft.co.th>`__:

- Saran Lim. saranl@ecosoft.co.th

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

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

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-Saran440|

This module is part of the `OCA/timesheet <https://github.com/OCA/timesheet/tree/18.0/hr_timesheet_sheet_tier_validation>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions hr_timesheet_sheet_tier_validation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import models
14 changes: 14 additions & 0 deletions hr_timesheet_sheet_tier_validation/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2026 Ecosoft Co., Ltd (https://ecosoft.co.th/)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "HR Timesheet Sheet Tier Validation",
"summary": "Extends HR Timesheet Sheet to support a tier validation process.",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"author": "Ecosoft, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/timesheet",
"depends": ["hr_timesheet_sheet", "base_tier_validation"],
"data": ["views/hr_timesheet_sheet_view.xml"],
"maintainers": ["Saran440"],
}
4 changes: 4 additions & 0 deletions hr_timesheet_sheet_tier_validation/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import tier_definition
from . import hr_timesheet_sheet
29 changes: 29 additions & 0 deletions hr_timesheet_sheet_tier_validation/models/hr_timesheet_sheet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2026 Ecosoft Co., Ltd (https://ecosoft.co.th/)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, models


class HrTimesheetSheet(models.Model):
_name = "hr_timesheet.sheet"
_inherit = ["hr_timesheet.sheet", "tier.validation"]
_state_from = ["confirm"]
_state_to = ["done"]

_tier_validation_manual_config = False

@api.depends("review_ids.status", "validation_status", "review_policy")
def _compute_can_review(self):
res = super()._compute_can_review()
for sheet in self.filtered("review_ids"):
if sheet.validation_status == "validated":
sheet.can_review = sheet.env.user in sheet._get_possible_reviewers()
else:
sheet.can_review = bool(sheet._get_sequences_to_approve(sheet.env.user))
return res

def _allow_to_remove_reviews(self, values):
res = super()._allow_to_remove_reviews(values)
if values.get(self._state_field) == "draft":
return True
return res
14 changes: 14 additions & 0 deletions hr_timesheet_sheet_tier_validation/models/tier_definition.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2026 Ecosoft Co., Ltd (https://ecosoft.co.th/)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, models


class TierDefinition(models.Model):
_inherit = "tier.definition"

@api.model
def _get_tier_validation_model_names(self):
res = super()._get_tier_validation_model_names()
res.append("hr_timesheet.sheet")
return res
3 changes: 3 additions & 0 deletions hr_timesheet_sheet_tier_validation/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions hr_timesheet_sheet_tier_validation/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [Ecosoft](https://ecosoft.co.th):
- Saran Lim. <saranl@ecosoft.co.th>
4 changes: 4 additions & 0 deletions hr_timesheet_sheet_tier_validation/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Extends the HR Timesheet Sheet module to support a multi-level tier
validation (approval) process. Approvers can be configured per tier
definition. The timesheet sheet must pass all configured tiers before
reaching the **Approved** state.
50 changes: 50 additions & 0 deletions hr_timesheet_sheet_tier_validation/static/description/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>HR Timesheet Sheet Tier Validation</title>
<style type="text/css">

/*
:Author: David Goodger (goodger@python.org)
: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.
*/

/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }

table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }

.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }

.last, .with-subtitle {
margin-bottom: 0 ! important }

.hidden {
display: none }

.subscript {
vertical-align: sub;
font-size: smaller }

.superscript {
vertical-align: super;
font-size: smaller }

a.toc-backref {
text-decoration: none ;
color: black }
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_hr_timesheet_sheet_filter" model="ir.ui.view">
<field name="name">hr_timesheet.sheet.tier.validation.search</field>
<field name="model">hr_timesheet.sheet</field>
<field
name="inherit_id"
ref="hr_timesheet_sheet.view_hr_timesheet_sheet_filter"
/>
<field name="arch" type="xml">
<filter name="to_review" position="after">
<separator />
<filter
name="needs_review"
string="Needs my Review"
domain="[('reviewer_ids', 'in', uid), ('state', 'not in', ['done'])]"
help="Timesheet Sheets waiting for my review"
/>
<filter
name="tier_validated"
string="Validated"
domain="[('validated', '=', True)]"
help="Timesheet Sheets validated and ready to be approved"
/>
</filter>
</field>
</record>
</odoo>
Loading