diff --git a/portal_project_task_hide_timesheet/README.rst b/portal_project_task_hide_timesheet/README.rst new file mode 100644 index 0000000..52ec79c --- /dev/null +++ b/portal_project_task_hide_timesheet/README.rst @@ -0,0 +1,59 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +================================== +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 + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/license-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/19.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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Quartile + +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..91c5580 --- /dev/null +++ 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 new file mode 100644 index 0000000..39db48f --- /dev/null +++ b/portal_project_task_hide_timesheet/__manifest__.py @@ -0,0 +1,14 @@ +# 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", + "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", + "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/pyproject.toml b/portal_project_task_hide_timesheet/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/portal_project_task_hide_timesheet/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/portal_project_task_hide_timesheet/readme/DESCRIPTION.md b/portal_project_task_hide_timesheet/readme/DESCRIPTION.md new file mode 100644 index 0000000..3e0fcf9 --- /dev/null +++ b/portal_project_task_hide_timesheet/readme/DESCRIPTION.md @@ -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..86baf15 --- /dev/null +++ b/portal_project_task_hide_timesheet/static/description/index.html @@ -0,0 +1,415 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Quartile
  • +
+
+
+

Maintainers

+

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

+

You are welcome to contribute.

+
+
+
+
+ +