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
59 changes: 59 additions & 0 deletions portal_project_task_hide_timesheet/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/qrtl/qrtl-custom/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/qrtl/qrtl-custom/issues/new?body=module:%20portal_project_task_hide_timesheet%0Aversion:%2019.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
-------

* Quartile

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

This module is part of the `qrtl/qrtl-custom <https://github.com/qrtl/qrtl-custom/tree/19.0/portal_project_task_hide_timesheet>`_ project on GitHub.

You are welcome to contribute.
2 changes: 2 additions & 0 deletions portal_project_task_hide_timesheet/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
14 changes: 14 additions & 0 deletions portal_project_task_hide_timesheet/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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,
}
1 change: 1 addition & 0 deletions portal_project_task_hide_timesheet/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import portal
19 changes: 19 additions & 0 deletions portal_project_task_hide_timesheet/controllers/portal.py
Original file line number Diff line number Diff line change
@@ -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/<id>?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)
1 change: 1 addition & 0 deletions portal_project_task_hide_timesheet/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_analytic_line
15 changes: 15 additions & 0 deletions portal_project_task_hide_timesheet/models/account_analytic_line.py
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions portal_project_task_hide_timesheet/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions portal_project_task_hide_timesheet/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module hides the timsheet information in portal task view.
Loading
Loading