diff --git a/maintenance_equipment_usage/README.rst b/maintenance_equipment_usage/README.rst new file mode 100644 index 000000000..5b127a4b4 --- /dev/null +++ b/maintenance_equipment_usage/README.rst @@ -0,0 +1,90 @@ +=========================== +Maintenance Equipment Usage +=========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:d53788ade2957febd9e19be9b1d26ece20167e5aaeaab1d3946180ff53896b23 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/17.0/maintenance_equipment_usage + :alt: OCA/maintenance +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/maintenance-17-0/maintenance-17-0-maintenance_equipment_usage + :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=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to record usages of maintenante equipments by +employees, with their dates, states and comments. + +**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 +------- + +* César Fernández +* Tecnativa + +Contributors +------------ + +- César Fernández Domínguez +- `Tecnativa `__: + + - Víctor Martínez + - Pedro M. Baeza + +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_equipment_usage/__init__.py b/maintenance_equipment_usage/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/maintenance_equipment_usage/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/maintenance_equipment_usage/__manifest__.py b/maintenance_equipment_usage/__manifest__.py new file mode 100644 index 000000000..1d33bf7a7 --- /dev/null +++ b/maintenance_equipment_usage/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2021 César Fernández Domínguez +# Copyright 2024 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Maintenance Equipment Usage", + "version": "17.0.1.0.0", + "category": "Maintenance", + "website": "https://github.com/OCA/maintenance", + "author": "César Fernández, Tecnativa, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": ["maintenance"], + "installable": True, + "data": [ + "security/ir.model.access.csv", + "security/security.xml", + "data/ir_sequence_data.xml", + "views/maintenance_equipment_usage_views.xml", + "views/maintenance_equipment_view.xml", + ], + "maintainers": ["victoralmau"], +} diff --git a/maintenance_equipment_usage/data/ir_sequence_data.xml b/maintenance_equipment_usage/data/ir_sequence_data.xml new file mode 100644 index 000000000..bd9a9c4c1 --- /dev/null +++ b/maintenance_equipment_usage/data/ir_sequence_data.xml @@ -0,0 +1,12 @@ + + + + Maintenance Equipment Usage + maintenance.equipment.usage + EU/ + 5 + 1 + 1 + + + diff --git a/maintenance_equipment_usage/i18n/es.po b/maintenance_equipment_usage/i18n/es.po new file mode 100644 index 000000000..b1f23de60 --- /dev/null +++ b/maintenance_equipment_usage/i18n/es.po @@ -0,0 +1,407 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_equipment_usage +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-02-27 10:56+0000\n" +"PO-Revision-Date: 2024-03-23 09:34+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_equipment_usage +#: model_terms:ir.ui.view,arch_db:maintenance_equipment_usage.hr_equipment_view_form +#: model_terms:ir.ui.view,arch_db:maintenance_equipment_usage.hr_equipment_view_kanban +msgid "" +" + + diff --git a/maintenance_equipment_usage/static/description/icon.png b/maintenance_equipment_usage/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/maintenance_equipment_usage/static/description/icon.png differ diff --git a/maintenance_equipment_usage/static/description/index.html b/maintenance_equipment_usage/static/description/index.html new file mode 100644 index 000000000..e62f24579 --- /dev/null +++ b/maintenance_equipment_usage/static/description/index.html @@ -0,0 +1,429 @@ + + + + + +Maintenance Equipment Usage + + + +
+

Maintenance Equipment Usage

+ + +

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

+

This module allows to record usages of maintenante equipments by +employees, with their dates, states and comments.

+

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

+
    +
  • César Fernández
  • +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • César Fernández Domínguez
  • +
  • Tecnativa:
      +
    • Víctor Martínez
    • +
    • Pedro M. Baeza
    • +
    +
  • +
+
+
+

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_equipment_usage/tests/__init__.py b/maintenance_equipment_usage/tests/__init__.py new file mode 100644 index 000000000..487a399b0 --- /dev/null +++ b/maintenance_equipment_usage/tests/__init__.py @@ -0,0 +1 @@ +from . import test_maintenance_equipment_usage diff --git a/maintenance_equipment_usage/tests/test_maintenance_equipment_usage.py b/maintenance_equipment_usage/tests/test_maintenance_equipment_usage.py new file mode 100644 index 000000000..575893878 --- /dev/null +++ b/maintenance_equipment_usage/tests/test_maintenance_equipment_usage.py @@ -0,0 +1,54 @@ +# Copyright 2022-2024 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.exceptions import UserError +from odoo.tests import Form, new_test_user + +from odoo.addons.base.tests.common import BaseCommon + + +class TestMaintenanceEquipmentUsage(BaseCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.user = new_test_user(cls.env, login="test_basic_user") + cls.equipment = cls.env["maintenance.equipment"].create( + {"name": "Test equipment"} + ) + cls.equipment_usage = cls._create_equipment_usage() + + @classmethod + def _create_equipment_usage(cls): + equipment_usage_form = Form(cls.env["maintenance.equipment.usage"]) + equipment_usage_form.equipment_id = cls.equipment + equipment_usage_form.user_id = cls.user + return equipment_usage_form.save() + + def test_maintenance_equipment_full_process(self): + self.assertIn(self.equipment_usage, self.equipment.usage_ids) + self.assertFalse(self.equipment.in_use) + self.assertEqual(self.equipment_usage.state, "draft") + self.equipment_usage.action_pick() + self.assertTrue(self.equipment_usage.date_picking) + self.assertEqual(self.equipment_usage.state, "in_use") + self.assertTrue(self.equipment.in_use) + self.equipment_usage.action_return() + self.assertEqual(self.equipment_usage.state, "returned") + self.assertTrue(self.equipment_usage.date_return) + self.assertFalse(self.equipment.in_use) + + def test_maintenance_equipment_cancel_process(self): + self.assertEqual(self.equipment_usage.state, "draft") + self.equipment_usage.action_cancel() + self.assertEqual(self.equipment_usage.state, "cancel") + + def test_maintenance_equipment_multi(self): + self.equipment_usage.action_pick() + self.assertEqual(self.equipment_usage.state, "in_use") + equipment_usage2 = self._create_equipment_usage() + with self.assertRaises(UserError): + equipment_usage2.action_pick() + self.equipment_usage.action_cancel() + self.assertEqual(self.equipment_usage.state, "cancel") + equipment_usage2.action_pick() + self.assertEqual(equipment_usage2.state, "in_use") diff --git a/maintenance_equipment_usage/views/maintenance_equipment_usage_views.xml b/maintenance_equipment_usage/views/maintenance_equipment_usage_views.xml new file mode 100644 index 000000000..03a2d3212 --- /dev/null +++ b/maintenance_equipment_usage/views/maintenance_equipment_usage_views.xml @@ -0,0 +1,223 @@ + + + + maintenance.equipment.usage.tree + maintenance.equipment.usage + + + + + + + + + + + + + + maintenance.equipment.usage.form + maintenance.equipment.usage + +
+
+
+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+
+
+
+ + maintenance.equipment.usage.search + maintenance.equipment.usage + + + + + + + + + + + + + + + + + + + + + + + Equipment Usage + ir.actions.act_window + maintenance.equipment.usage + tree,form + + {'search_default_not_returned': 1} + +

Click to create an Equipment Usage.

+
+
+ + + + Equipment Usage + ir.actions.act_window + maintenance.equipment.usage + tree,form + + + {'default_equipment_id': active_id, 'search_default_not_returned': 1} + [('equipment_id', '=', active_id)] + +

Click to create an Equipment Usage.

+
+
+
diff --git a/maintenance_equipment_usage/views/maintenance_equipment_view.xml b/maintenance_equipment_usage/views/maintenance_equipment_view.xml new file mode 100644 index 000000000..afd9da156 --- /dev/null +++ b/maintenance_equipment_usage/views/maintenance_equipment_view.xml @@ -0,0 +1,46 @@ + + + + equipment.kanban + maintenance.equipment + + + + + + + In use + + + + + equipment.form + maintenance.equipment + + +
+ +
+ + + In use + +
+
+