diff --git a/hr_timesheet_unpropagate_project/README.rst b/hr_timesheet_unpropagate_project/README.rst new file mode 100644 index 0000000..e631c63 --- /dev/null +++ b/hr_timesheet_unpropagate_project/README.rst @@ -0,0 +1,65 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +================================ +HR Timesheet Unpropagate Project +================================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:02186f3de6b5866cd2b8a9942cbdc85eb64c228ea30ee13170689feadeafec63 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/hr_timesheet_unpropagate_project + :alt: qrtl/qrtl-custom + +|badge1| |badge2| |badge3| + +This module changes the behavior of standard Odoo to ensure that when +you reassign a task to a different project, any timesheets linked to +that task are not automatically updated. + +This can be useful in situations where your operation assumes that +timesheets may be linked to different projects than those of their +tasks. + +**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/hr_timesheet_unpropagate_project/__init__.py b/hr_timesheet_unpropagate_project/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/hr_timesheet_unpropagate_project/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/hr_timesheet_unpropagate_project/__manifest__.py b/hr_timesheet_unpropagate_project/__manifest__.py new file mode 100644 index 0000000..9a6646d --- /dev/null +++ b/hr_timesheet_unpropagate_project/__manifest__.py @@ -0,0 +1,14 @@ +# Copyright 2023 Quartile (https:/www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "HR Timesheet Unpropagate Project", + "summary": "Keep the project of validated or others' timesheet lines unchanged", + "category": "Timesheet", + "version": "19.0.1.0.0", + "author": "Quartile", + "website": "https://www.quartile.co", + "license": "AGPL-3", + "maintainers": ["AungKoKoLin1997"], + "depends": ["hr_timesheet"], + "installable": True, +} diff --git a/hr_timesheet_unpropagate_project/models/__init__.py b/hr_timesheet_unpropagate_project/models/__init__.py new file mode 100644 index 0000000..1bc3ba3 --- /dev/null +++ b/hr_timesheet_unpropagate_project/models/__init__.py @@ -0,0 +1 @@ +from . import hr_timesheet diff --git a/hr_timesheet_unpropagate_project/models/hr_timesheet.py b/hr_timesheet_unpropagate_project/models/hr_timesheet.py new file mode 100644 index 0000000..d3d9a5a --- /dev/null +++ b/hr_timesheet_unpropagate_project/models/hr_timesheet.py @@ -0,0 +1,16 @@ +# Copyright 2023 Quartile Limited +# 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 _compute_project_id(self): + # Avoid updating the project of existing timesheet records which are already + # validated or not owned by the current user. + self = self.filtered( + lambda x: not x.validated and x.employee_id.user_id == self.env.user + ) + return super()._compute_project_id() diff --git a/hr_timesheet_unpropagate_project/pyproject.toml b/hr_timesheet_unpropagate_project/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/hr_timesheet_unpropagate_project/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/hr_timesheet_unpropagate_project/readme/DESCRIPTION.md b/hr_timesheet_unpropagate_project/readme/DESCRIPTION.md new file mode 100644 index 0000000..a3998b0 --- /dev/null +++ b/hr_timesheet_unpropagate_project/readme/DESCRIPTION.md @@ -0,0 +1,7 @@ +This module changes the behavior of standard Odoo to ensure that when +you reassign a task to a different project, any timesheets linked to +that task are not automatically updated. + +This can be useful in situations where your operation assumes that +timesheets may be linked to different projects than those of their +tasks. diff --git a/hr_timesheet_unpropagate_project/static/description/index.html b/hr_timesheet_unpropagate_project/static/description/index.html new file mode 100644 index 0000000..ef8afba --- /dev/null +++ b/hr_timesheet_unpropagate_project/static/description/index.html @@ -0,0 +1,420 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

HR Timesheet Unpropagate Project

+ +

Beta License: AGPL-3 qrtl/qrtl-custom

+

This module changes the behavior of standard Odoo to ensure that when +you reassign a task to a different project, any timesheets linked to +that task are not automatically updated.

+

This can be useful in situations where your operation assumes that +timesheets may be linked to different projects than those of their +tasks.

+

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.

+
+
+
+
+ +