diff --git a/maintenance_location_hr/README.rst b/maintenance_location_hr/README.rst new file mode 100644 index 000000000..54ce84cc1 --- /dev/null +++ b/maintenance_location_hr/README.rst @@ -0,0 +1,79 @@ +======================= +Maintenance Location Hr +======================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:43cc61559aafa8bcee437c408c3b93177ff9302799a8cf7153f6f42146de5299 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fmaintenance-lightgray.png?logo=github + :target: https://github.com/OCA/maintenance/tree/18.0/maintenance_location_hr + :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_location_hr + :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| + +Allow to assign equipments directly to a location. + +**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 +------- + +* Dixmit + +Contributors +------------ + +- Enric Tobella +- `NuoBiT `__: + + - Deniz Gallo dgallo@nuobit.com + +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. + +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_location_hr/__init__.py b/maintenance_location_hr/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/maintenance_location_hr/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/maintenance_location_hr/__manifest__.py b/maintenance_location_hr/__manifest__.py new file mode 100644 index 000000000..3859e7daa --- /dev/null +++ b/maintenance_location_hr/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2023 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Maintenance Location Hr", + "summary": """ + Assign equipments to locations""", + "version": "18.0.1.0.0", + "license": "AGPL-3", + "author": "Dixmit,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/maintenance", + "depends": ["maintenance_location", "hr_maintenance"], + "data": [ + "views/maintenance_location.xml", + "views/maintenance_equipment.xml", + ], + "demo": [], +} diff --git a/maintenance_location_hr/i18n/es.po b/maintenance_location_hr/i18n/es.po new file mode 100644 index 000000000..1c4e3c8c6 --- /dev/null +++ b/maintenance_location_hr/i18n/es.po @@ -0,0 +1,60 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_location_hr +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-12-28 12:33+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\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.17\n" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_equipment__display_name +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_location__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_equipment__id +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_location__id +msgid "ID" +msgstr "ID" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_equipment____last_update +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_location____last_update +msgid "Last Modified on" +msgstr "Última Modificación el" + +#. module: maintenance_location_hr +#: model:ir.model.fields.selection,name:maintenance_location_hr.selection__maintenance_equipment__equipment_assign_to__location +msgid "Location" +msgstr "Localización" + +#. module: maintenance_location_hr +#: model:ir.model,name:maintenance_location_hr.model_maintenance_equipment +msgid "Maintenance Equipment" +msgstr "Mantenimiento de Equipos" + +#. module: maintenance_location_hr +#: model:ir.model,name:maintenance_location_hr.model_maintenance_location +msgid "Maintenance Location" +msgstr "Localización de Mantenimiento" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_location__owner_id +msgid "Owner" +msgstr "Propietario" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_equipment__equipment_assign_to +msgid "Used By" +msgstr "Utilizado Por" diff --git a/maintenance_location_hr/i18n/fr.po b/maintenance_location_hr/i18n/fr.po new file mode 100644 index 000000000..c1f5863f9 --- /dev/null +++ b/maintenance_location_hr/i18n/fr.po @@ -0,0 +1,60 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_location_hr +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-06-18 12:02+0000\n" +"Last-Translator: Yann Papouin \n" +"Language-Team: none\n" +"Language: fr\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.17\n" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_equipment__display_name +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_location__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_equipment__id +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_location__id +msgid "ID" +msgstr "ID" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_equipment____last_update +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_location____last_update +msgid "Last Modified on" +msgstr "Dernière modification le" + +#. module: maintenance_location_hr +#: model:ir.model.fields.selection,name:maintenance_location_hr.selection__maintenance_equipment__equipment_assign_to__location +msgid "Location" +msgstr "Emplacement" + +#. module: maintenance_location_hr +#: model:ir.model,name:maintenance_location_hr.model_maintenance_equipment +msgid "Maintenance Equipment" +msgstr "Équipement de maintenance" + +#. module: maintenance_location_hr +#: model:ir.model,name:maintenance_location_hr.model_maintenance_location +msgid "Maintenance Location" +msgstr "Lieu de maintenance" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_location__owner_id +msgid "Owner" +msgstr "Propriétaire" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_equipment__equipment_assign_to +msgid "Used By" +msgstr "Utilisé par" diff --git a/maintenance_location_hr/i18n/it.po b/maintenance_location_hr/i18n/it.po new file mode 100644 index 000000000..ab7f501fe --- /dev/null +++ b/maintenance_location_hr/i18n/it.po @@ -0,0 +1,60 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_location_hr +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-12-19 15:34+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.17\n" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_equipment__display_name +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_location__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_equipment__id +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_location__id +msgid "ID" +msgstr "ID" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_equipment____last_update +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_location____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: maintenance_location_hr +#: model:ir.model.fields.selection,name:maintenance_location_hr.selection__maintenance_equipment__equipment_assign_to__location +msgid "Location" +msgstr "Ubicazione" + +#. module: maintenance_location_hr +#: model:ir.model,name:maintenance_location_hr.model_maintenance_equipment +msgid "Maintenance Equipment" +msgstr "Attrezzatura manutenzione" + +#. module: maintenance_location_hr +#: model:ir.model,name:maintenance_location_hr.model_maintenance_location +msgid "Maintenance Location" +msgstr "Ubicazione manutenzione" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_location__owner_id +msgid "Owner" +msgstr "Proprietario" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_equipment__equipment_assign_to +msgid "Used By" +msgstr "Usata da" diff --git a/maintenance_location_hr/i18n/maintenance_location_hr.pot b/maintenance_location_hr/i18n/maintenance_location_hr.pot new file mode 100644 index 000000000..c07f51f09 --- /dev/null +++ b/maintenance_location_hr/i18n/maintenance_location_hr.pot @@ -0,0 +1,57 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_location_hr +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.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_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_equipment__display_name +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_location__display_name +msgid "Display Name" +msgstr "" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_equipment__id +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_location__id +msgid "ID" +msgstr "" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_equipment____last_update +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_location____last_update +msgid "Last Modified on" +msgstr "" + +#. module: maintenance_location_hr +#: model:ir.model.fields.selection,name:maintenance_location_hr.selection__maintenance_equipment__equipment_assign_to__location +msgid "Location" +msgstr "" + +#. module: maintenance_location_hr +#: model:ir.model,name:maintenance_location_hr.model_maintenance_equipment +msgid "Maintenance Equipment" +msgstr "" + +#. module: maintenance_location_hr +#: model:ir.model,name:maintenance_location_hr.model_maintenance_location +msgid "Maintenance Location" +msgstr "" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_location__owner_id +msgid "Owner" +msgstr "" + +#. module: maintenance_location_hr +#: model:ir.model.fields,field_description:maintenance_location_hr.field_maintenance_equipment__equipment_assign_to +msgid "Used By" +msgstr "" diff --git a/maintenance_location_hr/models/__init__.py b/maintenance_location_hr/models/__init__.py new file mode 100644 index 000000000..58a95f74a --- /dev/null +++ b/maintenance_location_hr/models/__init__.py @@ -0,0 +1,2 @@ +from . import maintenance_equipment +from . import maintenance_location diff --git a/maintenance_location_hr/models/maintenance_equipment.py b/maintenance_location_hr/models/maintenance_equipment.py new file mode 100644 index 000000000..4b21a3b4c --- /dev/null +++ b/maintenance_location_hr/models/maintenance_equipment.py @@ -0,0 +1,22 @@ +# Copyright 2023 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class MaintenanceEquipment(models.Model): + _inherit = "maintenance.equipment" + + equipment_assign_to = fields.Selection( + selection_add=[("location", "Location")], + ondelete={"location": lambda r: r.write({"equipment_assign_to": "other"})}, + ) + + @api.depends("employee_id", "department_id", "equipment_assign_to", "location_id") + def _compute_owner(self): + location_equipments = self.filtered( + lambda r: r.equipment_assign_to == "location" + ) + for equipment in location_equipments: + equipment.owner_user_id = equipment.location_id.owner_id or self.env.user + return super(MaintenanceEquipment, self - location_equipments)._compute_owner() diff --git a/maintenance_location_hr/models/maintenance_location.py b/maintenance_location_hr/models/maintenance_location.py new file mode 100644 index 000000000..221c6a447 --- /dev/null +++ b/maintenance_location_hr/models/maintenance_location.py @@ -0,0 +1,10 @@ +# Copyright 2023 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class MaintenanceLocation(models.Model): + _inherit = "maintenance.location" + + owner_id = fields.Many2one("res.users") diff --git a/maintenance_location_hr/pyproject.toml b/maintenance_location_hr/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/maintenance_location_hr/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/maintenance_location_hr/readme/CONTRIBUTORS.md b/maintenance_location_hr/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..a090bd522 --- /dev/null +++ b/maintenance_location_hr/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- Enric Tobella +- [NuoBiT](https://www.nuobit.com): + - Deniz Gallo diff --git a/maintenance_location_hr/readme/DESCRIPTION.md b/maintenance_location_hr/readme/DESCRIPTION.md new file mode 100644 index 000000000..17c1ee405 --- /dev/null +++ b/maintenance_location_hr/readme/DESCRIPTION.md @@ -0,0 +1 @@ +Allow to assign equipments directly to a location. diff --git a/maintenance_location_hr/static/description/icon.png b/maintenance_location_hr/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/maintenance_location_hr/static/description/icon.png differ diff --git a/maintenance_location_hr/static/description/index.html b/maintenance_location_hr/static/description/index.html new file mode 100644 index 000000000..12e2f621d --- /dev/null +++ b/maintenance_location_hr/static/description/index.html @@ -0,0 +1,427 @@ + + + + + +Maintenance Location Hr + + + +
+

Maintenance Location Hr

+ + +

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

+

Allow to assign equipments directly to a location.

+

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

+
    +
  • Dixmit
  • +
+
+
+

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.

+

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_location_hr/tests/__init__.py b/maintenance_location_hr/tests/__init__.py new file mode 100644 index 000000000..7568e0c72 --- /dev/null +++ b/maintenance_location_hr/tests/__init__.py @@ -0,0 +1 @@ +from . import test_maintenance_location_hr diff --git a/maintenance_location_hr/tests/test_maintenance_location_hr.py b/maintenance_location_hr/tests/test_maintenance_location_hr.py new file mode 100644 index 000000000..8cd3f157c --- /dev/null +++ b/maintenance_location_hr/tests/test_maintenance_location_hr.py @@ -0,0 +1,27 @@ +# Copyright 2019 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase + + +class TestMaintenanceLocationHr(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.user = cls.env["res.users"].create( + { + "login": "demo_maintenance_location_hr", + "name": "Demo maintenance location HR", + } + ) + cls.location_1 = cls.env["maintenance.location"].create( + {"name": "L1", "owner_id": cls.user.id} + ) + cls.equipment = cls.env["maintenance.equipment"].create({"name": "Equipment"}) + + def test_maintenance_location(self): + self.assertNotEqual(self.user, self.equipment.owner_user_id) + self.equipment.write( + {"equipment_assign_to": "location", "location_id": self.location_1} + ) + self.assertEqual(self.user, self.equipment.owner_user_id) diff --git a/maintenance_location_hr/views/maintenance_equipment.xml b/maintenance_location_hr/views/maintenance_equipment.xml new file mode 100644 index 000000000..ad33273bd --- /dev/null +++ b/maintenance_location_hr/views/maintenance_equipment.xml @@ -0,0 +1,43 @@ + + + + + maintenance.equipment.form (in maintenance_location_hr) + maintenance.equipment + + + + equipment_assign_to == 'location' + equipment_assign_to not in [False, 'location', 'other'] + + + + + maintenance.equipment.form.inherit.hr (in maintenance_location_hr) + maintenance.equipment + + + + + equipment_assign_to not in [False, 'employee', 'other'] + + + equipment_assign_to not in [False, 'department', 'other'] + + + + diff --git a/maintenance_location_hr/views/maintenance_location.xml b/maintenance_location_hr/views/maintenance_location.xml new file mode 100644 index 000000000..ade0733c0 --- /dev/null +++ b/maintenance_location_hr/views/maintenance_location.xml @@ -0,0 +1,52 @@ + + + + + maintenance.location.form (in maintenance_location_hr) + maintenance.location + + + + + + + + + + maintenance.location.search (in maintenance_location_hr) + maintenance.location + + + + + + + + + + maintenance.location.tree (in maintenance_location_hr) + maintenance.location + + + + + + + + diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 000000000..834a4b571 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +odoo-addon-maintenance_location@git+https://github.com/OCA/maintenance.git@refs/pull/523/head#subdirectory=maintenance_location