Skip to content

Commit b7de292

Browse files
committed
[ADD] hr_timesheet_amount_security: New module
MT-14618
1 parent a8b93ed commit b7de292

16 files changed

Lines changed: 802 additions & 0 deletions
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
============================
2+
HR Timesheet Amount Security
3+
============================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:5ac1633036f36898d3ee2c4f4d38aad4126fa9ec33f334a86c35d7c5d0d7b212
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Alpha
16+
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
18+
:alt: License: LGPL-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_amount_security
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_amount_security
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 adds security restrictions to timesheet amount fields.
32+
33+
It restricts access to cost-related fields in timesheet reports to users
34+
who have the "Allow to read analytic costs" permission from the
35+
```analytic_amount_security`` <https://github.com/OCA/account-analytic/tree/18.0/analytic_amount_security>`__
36+
module.
37+
38+
.. IMPORTANT::
39+
This is an alpha version, the data model and design can change at any time without warning.
40+
Only for development or testing purpose, do not use in production.
41+
`More details on development status <https://odoo-community.org/page/development-status>`_
42+
43+
**Table of contents**
44+
45+
.. contents::
46+
:local:
47+
48+
Use Cases / Context
49+
===================
50+
51+
This module addresses the need to control which users can view cost
52+
information in timesheet reports. In many organizations, regular
53+
employees should be able to see time tracking information but not the
54+
monetary costs associated with that time.
55+
56+
The module leverages the ``group_allow_read_analytic_amount`` group from
57+
the
58+
```analytic_amount_security`` <https://github.com/OCA/account-analytic/tree/18.0/analytic_amount_security>`__
59+
module to restrict access to:
60+
61+
- Amount field in Timesheets Analysis Report
62+
- Cost fields in Timesheet Attendance Report (timesheets_cost,
63+
attendance_cost, cost_difference)
64+
65+
This allows for fine-grained control over financial data visibility
66+
while maintaining transparency for time tracking.
67+
68+
Bug Tracker
69+
===========
70+
71+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/timesheet/issues>`_.
72+
In case of trouble, please check there if your issue has already been reported.
73+
If you spotted it first, help us to smash it by providing a detailed and welcomed
74+
`feedback <https://github.com/OCA/timesheet/issues/new?body=module:%20hr_timesheet_amount_security%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
75+
76+
Do not contact contributors directly about support or help with technical issues.
77+
78+
Credits
79+
=======
80+
81+
Authors
82+
-------
83+
84+
* Moduon
85+
86+
Contributors
87+
------------
88+
89+
- Emilio Pascual emilio.pascual@moduon.team
90+
- Rafael Blasco rafael.bn@moduon.team
91+
92+
Maintainers
93+
-----------
94+
95+
This module is maintained by the OCA.
96+
97+
.. image:: https://odoo-community.org/logo.png
98+
:alt: Odoo Community Association
99+
:target: https://odoo-community.org
100+
101+
OCA, or the Odoo Community Association, is a nonprofit organization whose
102+
mission is to support the collaborative development of Odoo features and
103+
promote its widespread use.
104+
105+
.. |maintainer-EmilioPascual| image:: https://github.com/EmilioPascual.png?size=40px
106+
:target: https://github.com/EmilioPascual
107+
:alt: EmilioPascual
108+
.. |maintainer-rafaelbn| image:: https://github.com/rafaelbn.png?size=40px
109+
:target: https://github.com/rafaelbn
110+
:alt: rafaelbn
111+
112+
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
113+
114+
|maintainer-EmilioPascual| |maintainer-rafaelbn|
115+
116+
This module is part of the `OCA/timesheet <https://github.com/OCA/timesheet/tree/18.0/hr_timesheet_amount_security>`_ project on GitHub.
117+
118+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copyright 2025 Moduon Team S.L.
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
3+
from . import models
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2025 Moduon Team S.L.
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
3+
{
4+
"name": "HR Timesheet Amount Security",
5+
"summary": "Add security restrictions to timesheet amount fields",
6+
"version": "18.0.1.0.0",
7+
"development_status": "Alpha",
8+
"category": "Human Resources/Timesheets",
9+
"website": "https://github.com/OCA/timesheet",
10+
"author": "Moduon, Odoo Community Association (OCA)",
11+
"maintainers": ["EmilioPascual", "rafaelbn"],
12+
"license": "LGPL-3",
13+
"depends": [
14+
"analytic_amount_security",
15+
"hr_timesheet",
16+
"hr_timesheet_attendance",
17+
],
18+
"data": [],
19+
"auto_install": False,
20+
"installable": True,
21+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Translation of hr_timesheet_amount_security
2+
# Copyright (C) 2025 Moduon Team S.L.
3+
# This file is distributed under the same license as the hr_timesheet_amount_security package.
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: 18.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2025-05-05\n"
10+
"PO-Revision-Date: 2025-05-05\n"
11+
"Last-Translator: Emilio Pascual <emilio.pascual@moduon.team>\n"
12+
"Language-Team: Spanish\n"
13+
"Language: es\n"
14+
"MIME-Version: 1.0\n"
15+
"Content-Type: text/plain; charset=UTF-8\n"
16+
"Content-Transfer-Encoding: 8bit\n"
17+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
18+
19+
#. module: hr_timesheet_amount_security
20+
#: model:ir.model.fields,field_description:hr_timesheet_amount_security.field_hr_timesheet_attendance_report__attendance_cost
21+
msgid "Attendance Cost"
22+
msgstr "Coste de Asistencia"
23+
24+
#. module: hr_timesheet_amount_security
25+
#: model:ir.model.fields,field_description:hr_timesheet_amount_security.field_hr_timesheet_attendance_report__cost_difference
26+
msgid "Cost Difference"
27+
msgstr "Diferencia de Coste"
28+
29+
#. module: hr_timesheet_amount_security
30+
#: model:ir.model.fields,field_description:hr_timesheet_amount_security.field_timesheets_analysis_report__amount
31+
msgid "Amount"
32+
msgstr "Importe"
33+
34+
#. module: hr_timesheet_amount_security
35+
#: model:ir.model.fields,field_description:hr_timesheet_amount_security.field_hr_timesheet_attendance_report__timesheets_cost
36+
msgid "Timesheets Cost"
37+
msgstr "Coste de Parts de Horas"
38+
39+
#. module: hr_timesheet_amount_security
40+
#: model:ir.model,name:hr_timesheet_amount_security.model_hr_timesheet_attendance_report
41+
msgid "Timesheet Attendance Report"
42+
msgstr "Informe de Partes de Horas y Asistencia"
43+
44+
#. module: hr_timesheet_amount_security
45+
#: model:ir.model,name:hr_timesheet_amount_security.model_timesheets_analysis_report
46+
msgid "Timesheets Analysis Report"
47+
msgstr "Informe de Análisis de Parts de Horas"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Translation of hr_timesheet_amount_security
2+
# Copyright (C) 2025 Moduon Team S.L.
3+
# This file is distributed under the same license as the hr_timesheet_amount_security package.
4+
#
5+
#, fuzzy
6+
msgid ""
7+
msgstr ""
8+
"Project-Id-Version: 18.0\n"
9+
"Report-Msgid-Bugs-To: \n"
10+
"Last-Translator: \n"
11+
"Language-Team: \n"
12+
"MIME-Version: 1.0\n"
13+
"Content-Type: text/plain; charset=UTF-8\n"
14+
"Content-Transfer-Encoding: \n"
15+
"Plural-Forms: \n"
16+
17+
#. module: hr_timesheet_amount_security
18+
#: model:ir.model.fields,field_description:hr_timesheet_amount_security.field_hr_timesheet_attendance_report__attendance_cost
19+
msgid "Attendance Cost"
20+
msgstr ""
21+
22+
#. module: hr_timesheet_amount_security
23+
#: model:ir.model.fields,field_description:hr_timesheet_amount_security.field_hr_timesheet_attendance_report__cost_difference
24+
msgid "Cost Difference"
25+
msgstr ""
26+
27+
#. module: hr_timesheet_amount_security
28+
#: model:ir.model.fields,field_description:hr_timesheet_amount_security.field_timesheets_analysis_report__amount
29+
msgid "Amount"
30+
msgstr ""
31+
32+
#. module: hr_timesheet_amount_security
33+
#: model:ir.model.fields,field_description:hr_timesheet_amount_security.field_hr_timesheet_attendance_report__timesheets_cost
34+
msgid "Timesheets Cost"
35+
msgstr ""
36+
37+
#. module: hr_timesheet_amount_security
38+
#: model:ir.model,name:hr_timesheet_amount_security.model_hr_timesheet_attendance_report
39+
msgid "Timesheet Attendance Report"
40+
msgstr ""
41+
42+
#. module: hr_timesheet_amount_security
43+
#: model:ir.model,name:hr_timesheet_amount_security.model_timesheets_analysis_report
44+
msgid "Timesheets Analysis Report"
45+
msgstr ""
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright 2025 Moduon Team S.L.
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
3+
from . import timesheets_analysis_report
4+
from . import hr_timesheet_attendance_report
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2025 Moduon Team S.L.
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
3+
from odoo import fields, models
4+
5+
6+
class HrTimesheetAttendanceReport(models.Model):
7+
_inherit = "hr.timesheet.attendance.report"
8+
9+
timesheets_cost = fields.Float(
10+
groups="analytic_amount_security.group_allow_read_analytic_amount"
11+
)
12+
attendance_cost = fields.Float(
13+
groups="analytic_amount_security.group_allow_read_analytic_amount"
14+
)
15+
cost_difference = fields.Float(
16+
groups="analytic_amount_security.group_allow_read_analytic_amount"
17+
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright 2025 Moduon Team S.L.
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
3+
from odoo import fields, models
4+
5+
6+
class TimesheetsAnalysisReport(models.Model):
7+
_inherit = "timesheets.analysis.report"
8+
9+
amount = fields.Monetary(
10+
groups="analytic_amount_security.group_allow_read_analytic_amount"
11+
)
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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
This module addresses the need to control which users can view cost information
2+
in timesheet reports. In many organizations, regular employees should be able to
3+
see time tracking information but not the monetary costs associated with that time.
4+
5+
The module leverages the `group_allow_read_analytic_amount` group from the
6+
[`analytic_amount_security`](https://github.com/OCA/account-analytic/tree/18.0/analytic_amount_security)
7+
module to restrict access to:
8+
9+
- Amount field in Timesheets Analysis Report
10+
- Cost fields in Timesheet Attendance Report (timesheets_cost, attendance_cost,
11+
cost_difference)
12+
13+
This allows for fine-grained control over financial data visibility while
14+
maintaining transparency for time tracking.

0 commit comments

Comments
 (0)