diff --git a/maintenance_request_employee/README.rst b/maintenance_request_employee/README.rst new file mode 100644 index 000000000..9c9cb85b1 --- /dev/null +++ b/maintenance_request_employee/README.rst @@ -0,0 +1,92 @@ +============================ +Maintenance Request Employee +============================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:87bcdc107dbc4ed8c51fd2d8fe4d3a4368335e35553bdb03f19405e488103c6f + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png + :target: https://odoo-community.org/page/development-status + :alt: Production/Stable +.. |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%2Fmaintenance-lightgray.png?logo=github + :target: https://github.com/OCA/maintenance/tree/18.0/maintenance_request_employee + :alt: OCA/maintenance +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/maintenance-18-0/maintenance-18-0-maintenance_request_employee + :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/maintenance&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds the option to define employees in maintenance requests. + +**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 +------- + +* Tecnativa + +Contributors +------------ + +- `Tecnativa `__ + + - Pedro M. Baeza + - Víctor Martínez + - Carlos Lopez + +- `Heliconia Solutions Pvt. Ltd. `__ + + - Bhavesh Heliconia + +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-victoralmau| image:: https://github.com/victoralmau.png?size=40px + :target: https://github.com/victoralmau + :alt: victoralmau + +Current `maintainer `__: + +|maintainer-victoralmau| + +This module is part of the `OCA/maintenance `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/maintenance_request_employee/__init__.py b/maintenance_request_employee/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/maintenance_request_employee/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/maintenance_request_employee/__manifest__.py b/maintenance_request_employee/__manifest__.py new file mode 100644 index 000000000..2fcdc6388 --- /dev/null +++ b/maintenance_request_employee/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2023 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Maintenance Request Employee", + "version": "18.0.1.0.0", + "category": "Maintenance", + "website": "https://github.com/OCA/maintenance", + "author": "Tecnativa, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": ["hr_maintenance"], + "data": ["views/maintenance_request_views.xml"], + "installable": True, + "maintainers": ["victoralmau"], + "development_status": "Production/Stable", +} diff --git a/maintenance_request_employee/i18n/es.po b/maintenance_request_employee/i18n/es.po new file mode 100644 index 000000000..d16d51adc --- /dev/null +++ b/maintenance_request_employee/i18n/es.po @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_request_employee +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-02-22 10:23+0000\n" +"PO-Revision-Date: 2023-07-06 20:08+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: maintenance_request_employee +#: model:ir.model.fields,field_description:maintenance_request_employee.field_maintenance_request__employee_ids +msgid "Employees" +msgstr "Empleados" + +#. module: maintenance_request_employee +#: model_terms:ir.ui.view,arch_db:maintenance_request_employee.maintenance_request_view_search_inherit_hr +msgid "Involved Maintenances" +msgstr "Mantenimientos involucrados" + +#. module: maintenance_request_employee +#: model:ir.model,name:maintenance_request_employee.model_maintenance_request +msgid "Maintenance Request" +msgstr "Petición de mantenimiento" + +#~ msgid "Employee" +#~ msgstr "Empleado" diff --git a/maintenance_request_employee/i18n/it.po b/maintenance_request_employee/i18n/it.po new file mode 100644 index 000000000..95e99acf0 --- /dev/null +++ b/maintenance_request_employee/i18n/it.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_request_employee +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-03-08 21:22+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.14.1\n" + +#. module: maintenance_request_employee +#: model:ir.model.fields,field_description:maintenance_request_employee.field_maintenance_request__employee_ids +msgid "Employees" +msgstr "Dipendenti" + +#. module: maintenance_request_employee +#: model_terms:ir.ui.view,arch_db:maintenance_request_employee.maintenance_request_view_search_inherit_hr +msgid "Involved Maintenances" +msgstr "Manutenzioni coinvolte" + +#. module: maintenance_request_employee +#: model:ir.model,name:maintenance_request_employee.model_maintenance_request +msgid "Maintenance Request" +msgstr "Richiesta manutenzione" + +#~ msgid "Employee" +#~ msgstr "Dipendente" diff --git a/maintenance_request_employee/i18n/maintenance_request_employee.pot b/maintenance_request_employee/i18n/maintenance_request_employee.pot new file mode 100644 index 000000000..8b784d46b --- /dev/null +++ b/maintenance_request_employee/i18n/maintenance_request_employee.pot @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_request_employee +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: maintenance_request_employee +#: model:ir.model.fields,field_description:maintenance_request_employee.field_maintenance_request__employee_ids +msgid "Employees" +msgstr "" + +#. module: maintenance_request_employee +#: model_terms:ir.ui.view,arch_db:maintenance_request_employee.maintenance_request_view_search_inherit_hr +msgid "Involved Maintenances" +msgstr "" + +#. module: maintenance_request_employee +#: model:ir.model,name:maintenance_request_employee.model_maintenance_request +msgid "Maintenance Request" +msgstr "" diff --git a/maintenance_request_employee/models/__init__.py b/maintenance_request_employee/models/__init__.py new file mode 100644 index 000000000..df8c9b58f --- /dev/null +++ b/maintenance_request_employee/models/__init__.py @@ -0,0 +1 @@ +from . import maintenance_request diff --git a/maintenance_request_employee/models/maintenance_request.py b/maintenance_request_employee/models/maintenance_request.py new file mode 100644 index 000000000..ef5b7602b --- /dev/null +++ b/maintenance_request_employee/models/maintenance_request.py @@ -0,0 +1,10 @@ +# Copyright 2023 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class MaintenanceRequest(models.Model): + _inherit = "maintenance.request" + + employee_ids = fields.Many2many(comodel_name="hr.employee", string="Employees") diff --git a/maintenance_request_employee/pyproject.toml b/maintenance_request_employee/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/maintenance_request_employee/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/maintenance_request_employee/readme/CONTRIBUTORS.md b/maintenance_request_employee/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..94b89e004 --- /dev/null +++ b/maintenance_request_employee/readme/CONTRIBUTORS.md @@ -0,0 +1,6 @@ +- [Tecnativa](https://www.tecnativa.com) + - Pedro M. Baeza + - Víctor Martínez + - Carlos Lopez +- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io) + - Bhavesh Heliconia diff --git a/maintenance_request_employee/readme/DESCRIPTION.md b/maintenance_request_employee/readme/DESCRIPTION.md new file mode 100644 index 000000000..2c33993b4 --- /dev/null +++ b/maintenance_request_employee/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module adds the option to define employees in maintenance requests. diff --git a/maintenance_request_employee/static/description/icon.png b/maintenance_request_employee/static/description/icon.png new file mode 100644 index 000000000..a8d3ae158 Binary files /dev/null and b/maintenance_request_employee/static/description/icon.png differ diff --git a/maintenance_request_employee/static/description/icon.svg b/maintenance_request_employee/static/description/icon.svg new file mode 100644 index 000000000..30700656b --- /dev/null +++ b/maintenance_request_employee/static/description/icon.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/maintenance_request_employee/static/description/index.html b/maintenance_request_employee/static/description/index.html new file mode 100644 index 000000000..9878e7d8f --- /dev/null +++ b/maintenance_request_employee/static/description/index.html @@ -0,0 +1,434 @@ + + + + + +Maintenance Request Employee + + + +
+

Maintenance Request Employee

+ + +

Production/Stable License: AGPL-3 OCA/maintenance Translate me on Weblate Try me on Runboat

+

This module adds the option to define employees in maintenance requests.

+

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

+
    +
  • Tecnativa
  • +
+
+
+

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:

+

victoralmau

+

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

+

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

+
+
+
+ + diff --git a/maintenance_request_employee/tests/__init__.py b/maintenance_request_employee/tests/__init__.py new file mode 100644 index 000000000..894fc6ad8 --- /dev/null +++ b/maintenance_request_employee/tests/__init__.py @@ -0,0 +1 @@ +from . import test_maintenance_request_employee diff --git a/maintenance_request_employee/tests/test_maintenance_request_employee.py b/maintenance_request_employee/tests/test_maintenance_request_employee.py new file mode 100644 index 000000000..5a92b876b --- /dev/null +++ b/maintenance_request_employee/tests/test_maintenance_request_employee.py @@ -0,0 +1,39 @@ +# Copyright 2023 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo.tests import TransactionCase + + +class TestMaintenanceRequest(TransactionCase): + def setUp(self): + super().setUp() + # Create some test employees + self.employee_1 = self.env["hr.employee"].create({"name": "Employee 1"}) + self.employee_2 = self.env["hr.employee"].create({"name": "Employee 2"}) + + def test_maintenance_request_with_employees(self): + # Create a maintenance request and assign employees + maintenance_request = self.env["maintenance.request"].create( + { + "name": "Test Request", + "employee_ids": [(6, 0, [self.employee_1.id, self.employee_2.id])], + } + ) + + # Ensure the request was created + self.assertTrue(maintenance_request) + + # Check if employees are correctly linked + self.assertEqual(len(maintenance_request.employee_ids), 2) + self.assertIn(self.employee_1, maintenance_request.employee_ids) + self.assertIn(self.employee_2, maintenance_request.employee_ids) + + def test_maintenance_request_without_employees(self): + # Create a maintenance request without assigning any employees + maintenance_request = self.env["maintenance.request"].create( + { + "name": "Test Request No Employees", + } + ) + + # Ensure no employees are assigned + self.assertEqual(len(maintenance_request.employee_ids), 0) diff --git a/maintenance_request_employee/views/maintenance_request_views.xml b/maintenance_request_employee/views/maintenance_request_views.xml new file mode 100644 index 000000000..adca5c732 --- /dev/null +++ b/maintenance_request_employee/views/maintenance_request_views.xml @@ -0,0 +1,54 @@ + + + + maintenance.request.view.search.inherit.hr + + maintenance.request + + + + + + + + + + + maintenance.request.view.form.inherit.hr + + maintenance.request + + + + + + + + maintenance.request.view.kanban.inherit.hr + + maintenance.request + + + + + +
+ +
+
+
+
+