Skip to content

Commit 816d9d0

Browse files
committed
[ADD] project_timesheet_holidays_task_enable
Add 'timeoff_enable_use_timesheets' field to project tasks to bypass the native restriction that prevents manual timesheet logging on tasks linked to time off types.
1 parent d8dbbe3 commit 816d9d0

15 files changed

Lines changed: 694 additions & 0 deletions
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
===========================================
2+
Project Timesheet Holidays - re-enable task
3+
===========================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:c73e37413db874026ad8fdce11c36806b9b5b0a83205f3a5708992fab9f95578
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/project_timesheet_holidays_task_enable
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-project_timesheet_holidays_task_enable
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+
When a task is used in leave types configuration, it cannot be used
32+
filling manual timesheets. With this addon, it's possible to re-enable a
33+
task affected by this limitation.
34+
35+
**Table of contents**
36+
37+
.. contents::
38+
:local:
39+
40+
Bug Tracker
41+
===========
42+
43+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/timesheet/issues>`_.
44+
In case of trouble, please check there if your issue has already been reported.
45+
If you spotted it first, help us to smash it by providing a detailed and welcomed
46+
`feedback <https://github.com/OCA/timesheet/issues/new?body=module:%20project_timesheet_holidays_task_enable%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
47+
48+
Do not contact contributors directly about support or help with technical issues.
49+
50+
Credits
51+
=======
52+
53+
Authors
54+
-------
55+
56+
* Solvos Consultoría Informática
57+
58+
Contributors
59+
------------
60+
61+
- David ALonso <david.alonso@solvos.es>
62+
63+
Maintainers
64+
-----------
65+
66+
This module is maintained by the OCA.
67+
68+
.. image:: https://odoo-community.org/logo.png
69+
:alt: Odoo Community Association
70+
:target: https://odoo-community.org
71+
72+
OCA, or the Odoo Community Association, is a nonprofit organization whose
73+
mission is to support the collaborative development of Odoo features and
74+
promote its widespread use.
75+
76+
This module is part of the `OCA/timesheet <https://github.com/OCA/timesheet/tree/18.0/project_timesheet_holidays_task_enable>`_ project on GitHub.
77+
78+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# © 2025 Solvos Consultoría Informática (<https://www.solvos.es>)
2+
# License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0.html
3+
4+
{
5+
"name": "Project Timesheet Holidays - re-enable task",
6+
"description": "Re-enables task used in leave types",
7+
"category": "Human Resources",
8+
"version": "18.0.1.0.0",
9+
"depends": ["project_timesheet_holidays"],
10+
"data": ["views/project_task_views.xml"],
11+
"author": "Solvos Consultoría Informática, Odoo Community Association (OCA)",
12+
"website": "https://github.com/OCA/timesheet",
13+
"license": "AGPL-3",
14+
"installable": True,
15+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * project_timesheet_holidays_task_enable
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 17.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2025-10-08 13:42+0000\n"
10+
"PO-Revision-Date: 2025-10-08 15:44+0200\n"
11+
"Last-Translator: \n"
12+
"Language-Team: \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+
"X-Generator: Poedit 3.4.2\n"
19+
20+
#. module: project_timesheet_holidays_task_enable
21+
#: model:ir.model.fields,help:project_timesheet_holidays_task_enable.field_project_task__timeoff_enable_use_timesheets
22+
msgid ""
23+
"\n"
24+
" For a time off task, re-enables it usage in timesheets\n"
25+
" "
26+
msgstr ""
27+
"\n"
28+
" Para una tarea de ausencias, se rehabilita su uso en partes de horas\n"
29+
" "
30+
31+
#. module: project_timesheet_holidays_task_enable
32+
#: model:ir.model.fields,field_description:project_timesheet_holidays_task_enable.field_project_task__timeoff_enable_use_timesheets
33+
msgid "Enable use in timesheets when Used in Time Off"
34+
msgstr "Permitir su uso en partes de horas aun cuando es usada en Ausencias"
35+
36+
#. module: project_timesheet_holidays_task_enable
37+
#: model_terms:ir.ui.view,arch_db:project_timesheet_holidays_task_enable.view_task_form2_inherited
38+
msgid "Enable use in timesheets when used in Time Off"
39+
msgstr "Permitir su uso en partes de horas aun cuando es usada en Ausencias"
40+
41+
#. module: project_timesheet_holidays_task_enable
42+
#: model:ir.model,name:project_timesheet_holidays_task_enable.model_project_task
43+
msgid "Task"
44+
msgstr "Tarea"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * project_timesheet_holidays_task_enable
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 17.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2025-10-08 13:42+0000\n"
10+
"PO-Revision-Date: 2025-10-08 13:42+0000\n"
11+
"Last-Translator: \n"
12+
"Language-Team: \n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: \n"
17+
18+
#. module: project_timesheet_holidays_task_enable
19+
#: model:ir.model.fields,help:project_timesheet_holidays_task_enable.field_project_task__timeoff_enable_use_timesheets
20+
msgid ""
21+
"\n"
22+
" For a time off task, re-enables it usage in timesheets\n"
23+
" "
24+
msgstr ""
25+
26+
#. module: project_timesheet_holidays_task_enable
27+
#: model:ir.model.fields,field_description:project_timesheet_holidays_task_enable.field_project_task__timeoff_enable_use_timesheets
28+
msgid "Enable use in timesheets when Used in Time Off"
29+
msgstr ""
30+
31+
#. module: project_timesheet_holidays_task_enable
32+
#: model_terms:ir.ui.view,arch_db:project_timesheet_holidays_task_enable.view_task_form2_inherited
33+
msgid "Enable use in timesheets when used in Time Off"
34+
msgstr ""
35+
36+
#. module: project_timesheet_holidays_task_enable
37+
#: model:ir.model,name:project_timesheet_holidays_task_enable.model_project_task
38+
msgid "Task"
39+
msgstr ""
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import project_task
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# © 2025 Solvos Consultoría Informática (<https://www.solvos.es>)
2+
# License LGPL-3 - See https://www.gnu.org/licenses/lgpl-3.0.html
3+
4+
from odoo import fields, models
5+
6+
class ProjectTask(models.Model):
7+
_inherit = "project.task"
8+
9+
timeoff_enable_use_timesheets = fields.Boolean(
10+
string="Enable use in timesheets when Used in Time Off",
11+
help=
12+
"""
13+
For a time off task, re-enables it usage in timesheets
14+
""",
15+
)
16+
17+
def _compute_is_timeoff_task(self):
18+
super()._compute_is_timeoff_task()
19+
self.filtered(
20+
lambda x: x.is_timeoff_task and x.timeoff_enable_use_timesheets
21+
).is_timeoff_task = False
22+
23+
def _search_is_timeoff_task(self, operator, value):
24+
domain = super()._search_is_timeoff_task(operator, value)
25+
domain_list = list(domain[0])
26+
27+
tasks_ids = domain_list[2]
28+
new_tasks = self.browse(tasks_ids).filtered(
29+
lambda x: x.timeoff_enable_use_timesheets if value else not x.timeoff_enable_use_timesheets
30+
)
31+
domain_list[2] = new_tasks.ids
32+
return [tuple(domain_list)]
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
1. Go to Project > Task, select task that will be used as Leave Type. On Timesheet page and check "Enable use in timesheets when Used in Time Off"
2+
2. On Time Off>Configuration>Leave Types, with Debug Mode, select Project and Task.
3+
3. Now, from Timesheet, you can create with the enabled task.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* David ALonso \<david.alonso@solvos.es\>

0 commit comments

Comments
 (0)