diff --git a/hr_timesheet_begin_end_no_end/README.rst b/hr_timesheet_begin_end_no_end/README.rst new file mode 100644 index 0000000000..5e65ba1e93 --- /dev/null +++ b/hr_timesheet_begin_end_no_end/README.rst @@ -0,0 +1,88 @@ +========================================== +Timesheet - Begin/End Hours with empty end +========================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:6f9bf57eb39a36725b852081172b71f26e16fed507227ba22b894d0f1ed0d8e5 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-OCA%2Ftimesheet-lightgray.png?logo=github + :target: https://github.com/OCA/timesheet/tree/16.0/hr_timesheet_begin_end_no_end + :alt: OCA/timesheet +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/timesheet-16-0/timesheet-16-0-hr_timesheet_begin_end_no_end + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/timesheet&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Allow to insert begin hour without end hour on the timesheet. The benefit of +doing this is that you can save your begin hour at the start of your day/task, +and come back later to save the end hour. + +**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 +~~~~~~~ + +* Coop IT Easy SC + +Contributors +~~~~~~~~~~~~ + +* `Coop IT Easy SC `_: + + * Carmen Bianca BAKKER + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-carmenbianca| image:: https://github.com/carmenbianca.png?size=40px + :target: https://github.com/carmenbianca + :alt: carmenbianca + +Current `maintainer `__: + +|maintainer-carmenbianca| + +This module is part of the `OCA/timesheet `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/hr_timesheet_begin_end_no_end/__init__.py b/hr_timesheet_begin_end_no_end/__init__.py new file mode 100644 index 0000000000..3eb78877c5 --- /dev/null +++ b/hr_timesheet_begin_end_no_end/__init__.py @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: 2024 Coop IT Easy SC +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +from . import models diff --git a/hr_timesheet_begin_end_no_end/__manifest__.py b/hr_timesheet_begin_end_no_end/__manifest__.py new file mode 100644 index 0000000000..6926fa0d9c --- /dev/null +++ b/hr_timesheet_begin_end_no_end/__manifest__.py @@ -0,0 +1,22 @@ +# SPDX-FileCopyrightText: 2024 Coop IT Easy SC +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +{ + "name": "Timesheet - Begin/End Hours with empty end", + "summary": """ + Allow to insert begin hour without end hour, which the user may fill + in later.""", + "version": "12.0.1.0.0", + "category": "Human Resources", + "website": "https://github.com/OCA/timesheet", + "author": "Coop IT Easy SC, Odoo Community Association (OCA)", + "maintainers": ["carmenbianca"], + "license": "AGPL-3", + "application": False, + "depends": ["hr_timesheet_activity_begin_end"], + "excludes": [], + "data": [], + "demo": [], + "qweb": [], +} diff --git a/hr_timesheet_begin_end_no_end/models/__init__.py b/hr_timesheet_begin_end_no_end/models/__init__.py new file mode 100644 index 0000000000..84f4adcd2b --- /dev/null +++ b/hr_timesheet_begin_end_no_end/models/__init__.py @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: 2024 Coop IT Easy SC +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +from . import account_analytic_line diff --git a/hr_timesheet_begin_end_no_end/models/account_analytic_line.py b/hr_timesheet_begin_end_no_end/models/account_analytic_line.py new file mode 100644 index 0000000000..5a0fcdd75e --- /dev/null +++ b/hr_timesheet_begin_end_no_end/models/account_analytic_line.py @@ -0,0 +1,16 @@ +# SPDX-FileCopyrightText: 2024 Coop IT Easy SC +# +# SPDX-License-Identifier: AGPL-3.0-or-later + + +from odoo import models + + +class AccountAnalyticLine(models.Model): + _inherit = "account.analytic.line" + + def _validate_start_before_stop(self): + for line in self: + if line.time_stop: + super(AccountAnalyticLine, line)._validate_start_before_stop() + return diff --git a/hr_timesheet_begin_end_no_end/readme/CONTRIBUTORS.rst b/hr_timesheet_begin_end_no_end/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..f1ac675779 --- /dev/null +++ b/hr_timesheet_begin_end_no_end/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Coop IT Easy SC `_: + + * Carmen Bianca BAKKER diff --git a/hr_timesheet_begin_end_no_end/readme/DESCRIPTION.rst b/hr_timesheet_begin_end_no_end/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..8376256322 --- /dev/null +++ b/hr_timesheet_begin_end_no_end/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +Allow to insert begin hour without end hour on the timesheet. The benefit of +doing this is that you can save your begin hour at the start of your day/task, +and come back later to save the end hour. diff --git a/hr_timesheet_begin_end_no_end/static/description/index.html b/hr_timesheet_begin_end_no_end/static/description/index.html new file mode 100644 index 0000000000..76647fd432 --- /dev/null +++ b/hr_timesheet_begin_end_no_end/static/description/index.html @@ -0,0 +1,427 @@ + + + + + +Timesheet - Begin/End Hours with empty end + + + +
+

Timesheet - Begin/End Hours with empty end

+ + +

Beta License: AGPL-3 OCA/timesheet Translate me on Weblate Try me on Runboat

+

Allow to insert begin hour without end hour on the timesheet. The benefit of +doing this is that you can save your begin hour at the start of your day/task, +and come back later to save the end hour.

+

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

+
    +
  • Coop IT Easy SC
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainer:

+

carmenbianca

+

This module is part of the OCA/timesheet project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/hr_timesheet_begin_end_no_end/tests/__init__.py b/hr_timesheet_begin_end_no_end/tests/__init__.py new file mode 100644 index 0000000000..eae8ab8978 --- /dev/null +++ b/hr_timesheet_begin_end_no_end/tests/__init__.py @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: 2024 Coop IT Easy SC +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +from . import test_timesheet_begin_end_no_end diff --git a/hr_timesheet_begin_end_no_end/tests/test_timesheet_begin_end_no_end.py b/hr_timesheet_begin_end_no_end/tests/test_timesheet_begin_end_no_end.py new file mode 100644 index 0000000000..16e702c45b --- /dev/null +++ b/hr_timesheet_begin_end_no_end/tests/test_timesheet_begin_end_no_end.py @@ -0,0 +1,53 @@ +# SPDX-FileCopyrightText: 2024 Coop IT Easy SC +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +from odoo import exceptions, fields +from odoo.tests.common import TransactionCase + + +class TestBeginEndNoEnd(TransactionCase): + def setUp(self): + super().setUp() + self.project = self.env.ref("project.project_project_1") + self.employee = self.env.ref("hr.employee_qdp") + + def base_line(self): + return { + "name": "test", + "date": fields.Date.today(), + "time_start": 10.0, + "time_stop": 12.0, + "unit_amount": 2.0, + "project_id": self.project.id, + "employee_id": self.employee.id, + } + + def test_check_end_is_zero(self): + line = self.base_line() + line.update({"time_stop": 0}) + # No error. + self.env["account.analytic.line"].create(line) + + def test_check_end_is_not_zero(self): + line = self.base_line() + line_record = self.env["account.analytic.line"].create(line) + with self.assertRaises(exceptions.ValidationError): + line_record.time_stop = 1 + + def test_check_end_is_not_zero_no_record(self): + line = self.base_line() + line.update({"time_stop": 1, "unit_amount": 0}) + with self.assertRaises(exceptions.ValidationError): + self.env["account.analytic.line"].create(line) + + def test_no_overlap(self): + line_1 = self.base_line() + line_1.update({"time_stop": 0, "unit_amount": 0}) + line_2 = line_1.copy() + line_2.update({"time_start": 11.0, "unit_amount": 1}) + line_3 = self.base_line() + # Able to create all without overlap, because time_stop is 0 for two of + # them, and they don't count, even though their start times are + # overlapped with line_3. + self.env["account.analytic.line"].create([line_1, line_2, line_3]) diff --git a/setup/hr_timesheet_begin_end_no_end/odoo/addons/hr_timesheet_begin_end_no_end b/setup/hr_timesheet_begin_end_no_end/odoo/addons/hr_timesheet_begin_end_no_end new file mode 120000 index 0000000000..3bde95d631 --- /dev/null +++ b/setup/hr_timesheet_begin_end_no_end/odoo/addons/hr_timesheet_begin_end_no_end @@ -0,0 +1 @@ +../../../../hr_timesheet_begin_end_no_end \ No newline at end of file diff --git a/setup/hr_timesheet_begin_end_no_end/setup.py b/setup/hr_timesheet_begin_end_no_end/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/hr_timesheet_begin_end_no_end/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)