From 0ae0119baf0d6436d33dc9d67814ea2cc9c35deb Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Tue, 22 Nov 2022 08:28:47 +0630 Subject: [PATCH 1/7] change module name --- portal_project_task_hide_timesheet/README.rst | 52 +++ .../__init__.py | 0 .../__manifest__.py | 13 + .../readme/DESCRIPTION.rst | 1 + .../static/description/index.html | 407 ++++++++++++++++++ .../views/hr_timesheet_views.xml | 8 + 6 files changed, 481 insertions(+) create mode 100644 portal_project_task_hide_timesheet/README.rst create mode 100644 portal_project_task_hide_timesheet/__init__.py create mode 100644 portal_project_task_hide_timesheet/__manifest__.py create mode 100644 portal_project_task_hide_timesheet/readme/DESCRIPTION.rst create mode 100644 portal_project_task_hide_timesheet/static/description/index.html create mode 100644 portal_project_task_hide_timesheet/views/hr_timesheet_views.xml diff --git a/portal_project_task_hide_timesheet/README.rst b/portal_project_task_hide_timesheet/README.rst new file mode 100644 index 0000000..faecba4 --- /dev/null +++ b/portal_project_task_hide_timesheet/README.rst @@ -0,0 +1,52 @@ +================================== +Hide timesheet task in portal page +================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-qrtl%2Fqrtl--custom-lightgray.png?logo=github + :target: https://github.com/qrtl/qrtl-custom/tree/16.0/portal_project_task_hide_timesheet + :alt: qrtl/qrtl-custom + +|badge1| |badge2| |badge3| + +This module hides the timsheet information in portal task view. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Quartile Limited + +Maintainers +~~~~~~~~~~~ + +This module is part of the `qrtl/qrtl-custom `_ project on GitHub. + +You are welcome to contribute. diff --git a/portal_project_task_hide_timesheet/__init__.py b/portal_project_task_hide_timesheet/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/portal_project_task_hide_timesheet/__manifest__.py b/portal_project_task_hide_timesheet/__manifest__.py new file mode 100644 index 0000000..a941491 --- /dev/null +++ b/portal_project_task_hide_timesheet/__manifest__.py @@ -0,0 +1,13 @@ +# Copyright 2019 Quartile Limited +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Hide timesheet task in portal page", + "version": "16.0.1.0.0", + "depends": ["hr_timesheet"], + "author": "Quartile Limited", + "license": "AGPL-3", + "website": "https://www.quartile.co", + "category": "HR", + "data": ["views/hr_timesheet_views.xml"], + "installable": True, +} diff --git a/portal_project_task_hide_timesheet/readme/DESCRIPTION.rst b/portal_project_task_hide_timesheet/readme/DESCRIPTION.rst new file mode 100644 index 0000000..3e0fcf9 --- /dev/null +++ b/portal_project_task_hide_timesheet/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module hides the timsheet information in portal task view. diff --git a/portal_project_task_hide_timesheet/static/description/index.html b/portal_project_task_hide_timesheet/static/description/index.html new file mode 100644 index 0000000..a89ba0f --- /dev/null +++ b/portal_project_task_hide_timesheet/static/description/index.html @@ -0,0 +1,407 @@ + + + + + + +Hide timesheet task in portal page + + + +
+

Hide timesheet task in portal page

+ + +

Beta License: AGPL-3 qrtl/qrtl-custom

+

This module hides the timsheet information in portal task view.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Quartile Limited
  • +
+
+
+

Maintainers

+

This module is part of the qrtl/qrtl-custom project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/portal_project_task_hide_timesheet/views/hr_timesheet_views.xml b/portal_project_task_hide_timesheet/views/hr_timesheet_views.xml new file mode 100644 index 0000000..8a89388 --- /dev/null +++ b/portal_project_task_hide_timesheet/views/hr_timesheet_views.xml @@ -0,0 +1,8 @@ + + + + + False + + + From 18d8cea30024adc5ac2ebd3b022da34f3fb5195f Mon Sep 17 00:00:00 2001 From: "Aung Ko Ko Lin (Quartile)" <45355704+AungKoKoLin1997@users.noreply.github.com> Date: Tue, 3 Oct 2023 19:42:48 +0630 Subject: [PATCH 2/7] [3829][UPD] dotfiles (#38) --- portal_project_task_hide_timesheet/README.rst | 9 ++++-- .../static/description/index.html | 30 ++++++++++--------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/portal_project_task_hide_timesheet/README.rst b/portal_project_task_hide_timesheet/README.rst index faecba4..fbe7932 100644 --- a/portal_project_task_hide_timesheet/README.rst +++ b/portal_project_task_hide_timesheet/README.rst @@ -2,10 +2,13 @@ Hide timesheet task in portal page ================================== -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:86925857400fb58097ec70667bae197a732bc3c8902d56cdaed1e10e26eb24ff + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status @@ -17,7 +20,7 @@ Hide timesheet task in portal page :target: https://github.com/qrtl/qrtl-custom/tree/16.0/portal_project_task_hide_timesheet :alt: qrtl/qrtl-custom -|badge1| |badge2| |badge3| +|badge1| |badge2| |badge3| This module hides the timsheet information in portal task view. @@ -31,7 +34,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us smashing it by providing a detailed and welcomed +If you spotted it first, help us to smash it by providing a detailed and welcomed `feedback `_. Do not contact contributors directly about support or help with technical issues. diff --git a/portal_project_task_hide_timesheet/static/description/index.html b/portal_project_task_hide_timesheet/static/description/index.html index a89ba0f..741dcd5 100644 --- a/portal_project_task_hide_timesheet/static/description/index.html +++ b/portal_project_task_hide_timesheet/static/description/index.html @@ -1,20 +1,20 @@ - + - + Hide timesheet task in portal page -
-

Hide timesheet task in portal page

+
+ + +Odoo Community Association + +
+

Hide timesheet task in portal page

-

Beta License: AGPL-3 qrtl/qrtl-custom

+

Beta License: AGPL-3 qrtl/qrtl-custom

This module hides the timsheet information in portal task view.

Table of contents

@@ -382,27 +388,28 @@

Hide timesheet task in portal page

-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub 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.

+feedback.

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

-

Credits

+

Credits

-

Authors

+

Authors

  • Quartile Limited
-

Maintainers

-

This module is part of the qrtl/qrtl-custom project on GitHub.

+

Maintainers

+

This module is part of the qrtl/qrtl-custom project on GitHub.

You are welcome to contribute.

+
diff --git a/portal_project_task_hide_timesheet/views/hr_timesheet_views.xml b/portal_project_task_hide_timesheet/views/hr_timesheet_views.xml index 8a89388..9ffea70 100644 --- a/portal_project_task_hide_timesheet/views/hr_timesheet_views.xml +++ b/portal_project_task_hide_timesheet/views/hr_timesheet_views.xml @@ -1,8 +1,6 @@ - False - From 281c18d1bdc8e4570ac363986052c77add1c75f2 Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Tue, 9 Dec 2025 09:01:33 +0000 Subject: [PATCH 6/7] [MIG] portal_project_task_hide_timesheet: Migration to 19.0 --- portal_project_task_hide_timesheet/README.rst | 2 +- portal_project_task_hide_timesheet/__manifest__.py | 6 +++--- .../static/description/index.html | 2 +- .../views/hr_timesheet_views.xml | 14 ++++++++++---- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/portal_project_task_hide_timesheet/README.rst b/portal_project_task_hide_timesheet/README.rst index f3102b4..52ec79c 100644 --- a/portal_project_task_hide_timesheet/README.rst +++ b/portal_project_task_hide_timesheet/README.rst @@ -49,7 +49,7 @@ Credits Authors ------- -* Quartile Limited +* Quartile Maintainers ----------- diff --git a/portal_project_task_hide_timesheet/__manifest__.py b/portal_project_task_hide_timesheet/__manifest__.py index a941491..7c13e01 100644 --- a/portal_project_task_hide_timesheet/__manifest__.py +++ b/portal_project_task_hide_timesheet/__manifest__.py @@ -1,10 +1,10 @@ -# Copyright 2019 Quartile Limited +# Copyright 2019 Quartile (https://www.quartile.co) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Hide timesheet task in portal page", - "version": "16.0.1.0.0", + "version": "19.0.1.0.0", "depends": ["hr_timesheet"], - "author": "Quartile Limited", + "author": "Quartile", "license": "AGPL-3", "website": "https://www.quartile.co", "category": "HR", diff --git a/portal_project_task_hide_timesheet/static/description/index.html b/portal_project_task_hide_timesheet/static/description/index.html index 256aca9..86baf15 100644 --- a/portal_project_task_hide_timesheet/static/description/index.html +++ b/portal_project_task_hide_timesheet/static/description/index.html @@ -400,7 +400,7 @@

Credits

Authors

    -
  • Quartile Limited
  • +
  • Quartile
diff --git a/portal_project_task_hide_timesheet/views/hr_timesheet_views.xml b/portal_project_task_hide_timesheet/views/hr_timesheet_views.xml index 9ffea70..f1a5371 100644 --- a/portal_project_task_hide_timesheet/views/hr_timesheet_views.xml +++ b/portal_project_task_hide_timesheet/views/hr_timesheet_views.xml @@ -1,6 +1,12 @@ - + - - False - + From 52eb3f0243bd5d750aa5ec4653d14bd030cd5f59 Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Mon, 22 Jun 2026 10:51:01 +0000 Subject: [PATCH 7/7] [FIX] portal_project_task_hide_timesheet: block timesheet report route Hiding timesheets only through the portal template left the timesheet report reachable: /my/tasks/?report_type=pdf renders all of a task's timesheets via sudo, regardless of the template variable, so a portal user could still download them. Override account.analytic.line._show_portal_timesheets() to return False (the core hook that drives the template variable, replacing the fragile xpath that set it) and gate the report controller on the same method, so both the page and the downloadable report are consistently suppressed. Also add the manifest summary and maintainers. --- .../__init__.py | 2 ++ .../__manifest__.py | 3 ++- .../controllers/__init__.py | 1 + .../controllers/portal.py | 19 +++++++++++++++++++ .../models/__init__.py | 1 + .../models/account_analytic_line.py | 15 +++++++++++++++ .../views/hr_timesheet_views.xml | 12 ------------ 7 files changed, 40 insertions(+), 13 deletions(-) create mode 100644 portal_project_task_hide_timesheet/controllers/__init__.py create mode 100644 portal_project_task_hide_timesheet/controllers/portal.py create mode 100644 portal_project_task_hide_timesheet/models/__init__.py create mode 100644 portal_project_task_hide_timesheet/models/account_analytic_line.py delete mode 100644 portal_project_task_hide_timesheet/views/hr_timesheet_views.xml diff --git a/portal_project_task_hide_timesheet/__init__.py b/portal_project_task_hide_timesheet/__init__.py index e69de29..91c5580 100644 --- a/portal_project_task_hide_timesheet/__init__.py +++ b/portal_project_task_hide_timesheet/__init__.py @@ -0,0 +1,2 @@ +from . import controllers +from . import models diff --git a/portal_project_task_hide_timesheet/__manifest__.py b/portal_project_task_hide_timesheet/__manifest__.py index 7c13e01..39db48f 100644 --- a/portal_project_task_hide_timesheet/__manifest__.py +++ b/portal_project_task_hide_timesheet/__manifest__.py @@ -2,12 +2,13 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Hide timesheet task in portal page", + "summary": "Hide timesheet information from the portal task page and report", "version": "19.0.1.0.0", "depends": ["hr_timesheet"], "author": "Quartile", "license": "AGPL-3", "website": "https://www.quartile.co", "category": "HR", - "data": ["views/hr_timesheet_views.xml"], + "maintainers": ["AungKoKoLin1997"], "installable": True, } diff --git a/portal_project_task_hide_timesheet/controllers/__init__.py b/portal_project_task_hide_timesheet/controllers/__init__.py new file mode 100644 index 0000000..8c3feb6 --- /dev/null +++ b/portal_project_task_hide_timesheet/controllers/__init__.py @@ -0,0 +1 @@ +from . import portal diff --git a/portal_project_task_hide_timesheet/controllers/portal.py b/portal_project_task_hide_timesheet/controllers/portal.py new file mode 100644 index 0000000..5dcd6e6 --- /dev/null +++ b/portal_project_task_hide_timesheet/controllers/portal.py @@ -0,0 +1,19 @@ +# Copyright 2019 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.exceptions import MissingError +from odoo.http import request + +from odoo.addons.hr_timesheet.controllers.portal import ( + TimesheetProjectCustomerPortal, +) + + +class TimesheetProjectCustomerPortal(TimesheetProjectCustomerPortal): + def _show_task_report(self, task_sudo, report_type, download): + # The /my/tasks/?report_type= route only renders the timesheet + # report. When timesheets are hidden from the portal, block it so the + # data is not reachable through the download URL. + if not request.env["account.analytic.line"]._show_portal_timesheets(): + raise MissingError(request.env._("There is nothing to report.")) + return super()._show_task_report(task_sudo, report_type, download) diff --git a/portal_project_task_hide_timesheet/models/__init__.py b/portal_project_task_hide_timesheet/models/__init__.py new file mode 100644 index 0000000..f69550a --- /dev/null +++ b/portal_project_task_hide_timesheet/models/__init__.py @@ -0,0 +1 @@ +from . import account_analytic_line diff --git a/portal_project_task_hide_timesheet/models/account_analytic_line.py b/portal_project_task_hide_timesheet/models/account_analytic_line.py new file mode 100644 index 0000000..845ea36 --- /dev/null +++ b/portal_project_task_hide_timesheet/models/account_analytic_line.py @@ -0,0 +1,15 @@ +# Copyright 2019 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models + + +class AccountAnalyticLine(models.Model): + _inherit = "account.analytic.line" + + def _show_portal_timesheets(self): + # Hide timesheet information from the portal task page and list. This + # is the core hook driving the "show_portal_timesheets" template + # variable; the report controller is gated on it as well so the + # timesheet report cannot be downloaded via ?report_type=. + return False diff --git a/portal_project_task_hide_timesheet/views/hr_timesheet_views.xml b/portal_project_task_hide_timesheet/views/hr_timesheet_views.xml deleted file mode 100644 index f1a5371..0000000 --- a/portal_project_task_hide_timesheet/views/hr_timesheet_views.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - -