From df31de6ea73c0862b333fe9e9b2fb16bf4fb457f Mon Sep 17 00:00:00 2001 From: Jaime Arroyo Date: Fri, 15 Nov 2019 13:23:57 +0100 Subject: [PATCH 01/28] [11.0][ADD] maintenance_location --- maintenance_location/README.rst | 1 + maintenance_location/__init__.py | 1 + maintenance_location/__manifest__.py | 20 +++ maintenance_location/i18n/es.po | 136 ++++++++++++++++++ .../i18n/maintenance_location.pot | 135 +++++++++++++++++ maintenance_location/models/__init__.py | 4 + .../models/maintenance_equipment.py | 21 +++ .../models/maintenance_location.py | 56 ++++++++ .../models/maintenance_plan.py | 11 ++ .../models/maintenance_request.py | 17 +++ .../security/ir.model.access.csv | 3 + .../static/description/icon.png | Bin 0 -> 9455 bytes maintenance_location/tests/__init__.py | 1 + .../tests/test_maintenance_location.py | 32 +++++ .../views/maintenance_equipment.xml | 58 ++++++++ .../views/maintenance_location.xml | 60 ++++++++ .../views/maintenance_plan.xml | 40 ++++++ .../views/maintenance_request.xml | 51 +++++++ 18 files changed, 647 insertions(+) create mode 100644 maintenance_location/README.rst create mode 100644 maintenance_location/__init__.py create mode 100644 maintenance_location/__manifest__.py create mode 100644 maintenance_location/i18n/es.po create mode 100644 maintenance_location/i18n/maintenance_location.pot create mode 100644 maintenance_location/models/__init__.py create mode 100644 maintenance_location/models/maintenance_equipment.py create mode 100644 maintenance_location/models/maintenance_location.py create mode 100644 maintenance_location/models/maintenance_plan.py create mode 100644 maintenance_location/models/maintenance_request.py create mode 100644 maintenance_location/security/ir.model.access.csv create mode 100644 maintenance_location/static/description/icon.png create mode 100644 maintenance_location/tests/__init__.py create mode 100644 maintenance_location/tests/test_maintenance_location.py create mode 100644 maintenance_location/views/maintenance_equipment.xml create mode 100644 maintenance_location/views/maintenance_location.xml create mode 100644 maintenance_location/views/maintenance_plan.xml create mode 100644 maintenance_location/views/maintenance_request.xml diff --git a/maintenance_location/README.rst b/maintenance_location/README.rst new file mode 100644 index 000000000..af276a928 --- /dev/null +++ b/maintenance_location/README.rst @@ -0,0 +1 @@ +Define a location system for maintenance diff --git a/maintenance_location/__init__.py b/maintenance_location/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/maintenance_location/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/maintenance_location/__manifest__.py b/maintenance_location/__manifest__.py new file mode 100644 index 000000000..358b99c14 --- /dev/null +++ b/maintenance_location/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2019 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Maintenance Location", + "summary": """ + Define a location system for maintenance""", + "version": "11.0.1.0.0", + "license": "AGPL-3", + "author": "Creu Blanca,Odoo Community Association (OCA)", + "website": "www.creublanca.es", + "depends": ["maintenance_plan", "web_widget_child_selector"], + "data": [ + "views/maintenance_plan.xml", + "views/maintenance_equipment.xml", + "security/ir.model.access.csv", + "views/maintenance_request.xml", + "views/maintenance_location.xml", + ], +} diff --git a/maintenance_location/i18n/es.po b/maintenance_location/i18n/es.po new file mode 100644 index 000000000..4e3f9dd5e --- /dev/null +++ b/maintenance_location/i18n/es.po @@ -0,0 +1,136 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_location +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-12-12 11:56+0000\n" +"PO-Revision-Date: 2019-12-12 13:00+0100\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"Language: es\n" +"X-Generator: Poedit 2.0.6\n" + +#. module: maintenance_location +#: model:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +msgid "Location name" +msgstr "Nombre de la ubicación" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_child_id +msgid "Child Locations" +msgstr "Ubicaciones Hijas" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_complete_name +msgid "Complete Name" +msgstr "Nombre completo" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_create_date +msgid "Created on" +msgstr "Creado en" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: maintenance_location +#: model:ir.model,name:maintenance_location.model_maintenance_equipment +msgid "Equipment" +msgstr "Equipamiento" + +#. module: maintenance_location +#: code:addons/maintenance_location/models/maintenance_location.py:52 +#, python-format +msgid "Error ! You cannot create recursive Locations." +msgstr "Error! No puedes crear ubicaciones cíclicas." + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_id +msgid "ID" +msgstr "ID (identificación)" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location___last_update +msgid "Last Modified on" +msgstr "Última modificación en" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_write_uid +msgid "Last Updated by" +msgstr "Última actualización de" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_write_date +msgid "Last Updated on" +msgstr "Última actualización en" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_parent_left +msgid "Left Parent" +msgstr "Padre izquierdo" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_equipment_location_id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_request_location_id +msgid "Location" +msgstr "Ubicación" + +#. module: maintenance_location +#: model:ir.ui.view,arch_db:maintenance_location.hr_equipment_request_view_kanban +msgid "Location :" +msgstr "Location :" + +#. module: maintenance_location +#: model:ir.actions.act_window,name:maintenance_location.maintenance_location_act_window +#: model:ir.model,name:maintenance_location.model_maintenance_location +msgid "Maintenance Location" +msgstr "Ubicación" + +#. module: maintenance_location +#: model:ir.ui.menu,name:maintenance_location.maintenance_location_menu +msgid "Maintenance Locations" +msgstr "Ubicaciones" + +#. module: maintenance_location +#: model:ir.model,name:maintenance_location.model_maintenance_request +msgid "Maintenance Requests" +msgstr "Peticiones de mantenimiento" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_name +msgid "Name" +msgstr "Nombre" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_parent_id +msgid "Parent Location" +msgstr "Ubicación padre" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_partner_id +msgid "Partner" +msgstr "Centro" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_parent_right +msgid "Right Parent" +msgstr "Padre derecho" + +#. module: maintenance_location +#: model:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +msgid "e.g. Building A" +msgstr "p.e. Edificio A" diff --git a/maintenance_location/i18n/maintenance_location.pot b/maintenance_location/i18n/maintenance_location.pot new file mode 100644 index 000000000..ec990dd3a --- /dev/null +++ b/maintenance_location/i18n/maintenance_location.pot @@ -0,0 +1,135 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_location +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-12-12 11:56+0000\n" +"PO-Revision-Date: 2019-12-12 11:56+0000\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 +#: model:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +msgid "Location name" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_child_id +msgid "Child Locations" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_complete_name +msgid "Complete Name" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_create_uid +msgid "Created by" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_create_date +msgid "Created on" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_display_name +msgid "Display Name" +msgstr "" + +#. module: maintenance_location +#: model:ir.model,name:maintenance_location.model_maintenance_equipment +msgid "Equipment" +msgstr "" + +#. module: maintenance_location +#: code:addons/maintenance_location/models/maintenance_location.py:52 +#, python-format +msgid "Error ! You cannot create recursive Locations." +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_id +msgid "ID" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location___last_update +msgid "Last Modified on" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_write_uid +msgid "Last Updated by" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_write_date +msgid "Last Updated on" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_parent_left +msgid "Left Parent" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_equipment_location_id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_request_location_id +msgid "Location" +msgstr "" + +#. module: maintenance_location +#: model:ir.ui.view,arch_db:maintenance_location.hr_equipment_request_view_kanban +msgid "Location :" +msgstr "" + +#. module: maintenance_location +#: model:ir.actions.act_window,name:maintenance_location.maintenance_location_act_window +#: model:ir.model,name:maintenance_location.model_maintenance_location +msgid "Maintenance Location" +msgstr "" + +#. module: maintenance_location +#: model:ir.ui.menu,name:maintenance_location.maintenance_location_menu +msgid "Maintenance Locations" +msgstr "" + +#. module: maintenance_location +#: model:ir.model,name:maintenance_location.model_maintenance_request +msgid "Maintenance Requests" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_name +msgid "Name" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_parent_id +msgid "Parent Location" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_partner_id +msgid "Partner" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_parent_right +msgid "Right Parent" +msgstr "" + +#. module: maintenance_location +#: model:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +msgid "e.g. Building A" +msgstr "" + diff --git a/maintenance_location/models/__init__.py b/maintenance_location/models/__init__.py new file mode 100644 index 000000000..3b2481dc9 --- /dev/null +++ b/maintenance_location/models/__init__.py @@ -0,0 +1,4 @@ +from . import maintenance_location +from . import maintenance_request +from . import maintenance_equipment +from . import maintenance_plan diff --git a/maintenance_location/models/maintenance_equipment.py b/maintenance_location/models/maintenance_equipment.py new file mode 100644 index 000000000..2a4b1f61a --- /dev/null +++ b/maintenance_location/models/maintenance_equipment.py @@ -0,0 +1,21 @@ +# Copyright 2019 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class MaintenanceEquipment(models.Model): + + _inherit = "maintenance.equipment" + + location_id = fields.Many2one("maintenance.location") + + def _prepare_request_from_plan( + self, maintenance_plan, next_maintenance_date + ): + res = super()._prepare_request_from_plan( + maintenance_plan, next_maintenance_date + ) + location = maintenance_plan.location_id or self.location_id + res.update({"location_id": location.id}) + return res diff --git a/maintenance_location/models/maintenance_location.py b/maintenance_location/models/maintenance_location.py new file mode 100644 index 000000000..fe52651e7 --- /dev/null +++ b/maintenance_location/models/maintenance_location.py @@ -0,0 +1,56 @@ +# Copyright 2019 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models, _ +from odoo.exceptions import ValidationError + + +class MaintenanceLocation(models.Model): + + _name = "maintenance.location" + _description = "Maintenance Location" + _parent_name = "parent_id" + _parent_store = True + _parent_order = "name" + _rec_name = "complete_name" + _order = "complete_name,id" + + name = fields.Char(required=True) + complete_name = fields.Char( + "Complete Name", compute="_compute_complete_name", store=True + ) + + partner_id = fields.Many2one("res.partner") + + parent_id = fields.Many2one( + "maintenance.location", + "Parent Location", + index=True, + ondelete="cascade", + ) + child_id = fields.One2many( + "maintenance.location", "parent_id", "Child Locations" + ) + parent_left = fields.Integer("Left Parent", index=1) + parent_right = fields.Integer("Right Parent", index=1) + + sequence = fields.Integer(string="Sequence", default=10) + + @api.depends("name", "parent_id.complete_name") + def _compute_complete_name(self): + for location in self: + if location.parent_id: + location.complete_name = "%s / %s" % ( + location.parent_id.complete_name, + location.name, + ) + else: + location.complete_name = location.name + + @api.constrains("parent_id") + def _check_category_recursion(self): + if not self._check_recursion(): + raise ValidationError( + _("Error ! You cannot create recursive Locations.") + ) + return True diff --git a/maintenance_location/models/maintenance_plan.py b/maintenance_location/models/maintenance_plan.py new file mode 100644 index 000000000..3a02e1f3e --- /dev/null +++ b/maintenance_location/models/maintenance_plan.py @@ -0,0 +1,11 @@ +# Copyright 2020 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class MaintenancePlan(models.Model): + + _inherit = "maintenance.plan" + + location_id = fields.Many2one("maintenance.location") diff --git a/maintenance_location/models/maintenance_request.py b/maintenance_location/models/maintenance_request.py new file mode 100644 index 000000000..442cd1f12 --- /dev/null +++ b/maintenance_location/models/maintenance_request.py @@ -0,0 +1,17 @@ +# Copyright 2019 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class MaintenanceRequest(models.Model): + + _inherit = "maintenance.request" + + location_id = fields.Many2one("maintenance.location") + + @api.onchange("equipment_id") + def _onchange_equipment_id(self): + for record in self.filtered("equipment_id"): + if record.equipment_id.location_id: + record.location_id = record.equipment_id.location_id diff --git a/maintenance_location/security/ir.model.access.csv b/maintenance_location/security/ir.model.access.csv new file mode 100644 index 000000000..0e7eb053f --- /dev/null +++ b/maintenance_location/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_maintenance_location,access_maintenance_location,model_maintenance_location,base.group_user,1,0,0,0 +access_maintenance_location_maintenance,access_maintenance_location_maintenance,model_maintenance_location,maintenance.group_equipment_manager,1,1,1,1 diff --git a/maintenance_location/static/description/icon.png b/maintenance_location/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}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xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/maintenance_location/tests/__init__.py b/maintenance_location/tests/__init__.py new file mode 100644 index 000000000..e76ac8f83 --- /dev/null +++ b/maintenance_location/tests/__init__.py @@ -0,0 +1 @@ +from . import test_maintenance_location diff --git a/maintenance_location/tests/test_maintenance_location.py b/maintenance_location/tests/test_maintenance_location.py new file mode 100644 index 000000000..2b338df92 --- /dev/null +++ b/maintenance_location/tests/test_maintenance_location.py @@ -0,0 +1,32 @@ +# Copyright 2019 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase +from odoo.exceptions import ValidationError + + +class TestMaintenanceLocation(TransactionCase): + def setUp(self): + super().setUp() + self.location_1 = self.env["maintenance.location"].create( + {"name": "L1"} + ) + self.location_2 = self.env["maintenance.location"].create( + {"name": "L2", "parent_id": self.location_1.id} + ) + self.equipment = self.env["maintenance.equipment"].create( + {"name": "L2", "location_id": self.location_1.id} + ) + self.team = self.env["maintenance.team"].create({"name": "Team"}) + self.request = self.env["maintenance.request"].create( + {"name": "Request", "maintenance_team_id": self.team.id} + ) + + def test_maintenance_location(self): + self.assertEqual(self.location_2.complete_name, "L1 / L2") + with self.assertRaises(ValidationError): + self.location_1.write({"parent_id": self.location_2.id}) + + self.request.write({"equipment_id": self.equipment.id}) + self.request._onchange_equipment_id() + self.assertEqual(self.request.location_id.id, self.location_1.id) diff --git a/maintenance_location/views/maintenance_equipment.xml b/maintenance_location/views/maintenance_equipment.xml new file mode 100644 index 000000000..0695778cd --- /dev/null +++ b/maintenance_location/views/maintenance_equipment.xml @@ -0,0 +1,58 @@ + + + + + + + maintenance.equipment.form (in maintenance_location) + maintenance.equipment + + + + 1 + + + + + + + + + + + + maintenance.equipment.search (in maintenance_location) + maintenance.equipment + + + + + + + + + + maintenance.equipment.tree (in maintenance_location) + maintenance.equipment + + + + + + + + + + maintenance.equipment.tree (in maintenance_location) + maintenance.equipment + + +
+
+
+
+
+ +
diff --git a/maintenance_location/views/maintenance_location.xml b/maintenance_location/views/maintenance_location.xml new file mode 100644 index 000000000..d770c8d3a --- /dev/null +++ b/maintenance_location/views/maintenance_location.xml @@ -0,0 +1,60 @@ + + + + + + + maintenance.location.form (in cb_maintenance) + maintenance.location + +
+ +
+
+ + + +
+
+
+
+ + + maintenance.location.search (in cb_maintenance) + maintenance.location + + + + + + + + + maintenance.location.tree (in cb_maintenance) + maintenance.location + + + + + + + + + Maintenance Location + maintenance.location + tree,form + [] + {} + + + + Maintenance Locations + + + + + +
diff --git a/maintenance_location/views/maintenance_plan.xml b/maintenance_location/views/maintenance_plan.xml new file mode 100644 index 000000000..e53d087f1 --- /dev/null +++ b/maintenance_location/views/maintenance_plan.xml @@ -0,0 +1,40 @@ + + + + + + + maintenance.plan.form (in maintenance_location) + maintenance.plan + + + + + + + + + + maintenance.plan.search (in maintenance_location) + maintenance.plan + + + + + + + + + + maintenance.plan.tree (in maintenance_location) + maintenance.plan + + + + + + + + + diff --git a/maintenance_location/views/maintenance_request.xml b/maintenance_location/views/maintenance_request.xml new file mode 100644 index 000000000..dc3e182b7 --- /dev/null +++ b/maintenance_location/views/maintenance_request.xml @@ -0,0 +1,51 @@ + + + + + + + maintenance.request.form (in maintenance_location) + maintenance.request + + + + + + + + + + maintenance.request.search (in maintenance_location) + maintenance.request + + + + + + + + + + maintenance.request.tree (in maintenance_location) + maintenance.request + + + + + + + + + + maintenance.request.kanban (in maintenance_location) + maintenance.request + + + + Location :
+
+
+
+ +
From 176bb73693d3b4416054453e5ce4e5559d558bf4 Mon Sep 17 00:00:00 2001 From: Jaime Arroyo Date: Mon, 24 Feb 2020 13:46:59 +0100 Subject: [PATCH 02/28] [12.0][MIG] maintenance_location --- maintenance_location/__manifest__.py | 2 +- .../models/maintenance_equipment.py | 1 + .../models/maintenance_location.py | 10 ++--- .../models/maintenance_request.py | 4 +- .../tests/test_maintenance_location.py | 32 ++++++++++++-- .../views/maintenance_equipment.xml | 41 ++++++++++-------- .../views/maintenance_location.xml | 43 ++++++++----------- .../views/maintenance_plan.xml | 23 +++++----- .../views/maintenance_request.xml | 36 +++++++++------- 9 files changed, 109 insertions(+), 83 deletions(-) diff --git a/maintenance_location/__manifest__.py b/maintenance_location/__manifest__.py index 358b99c14..5f764f6e2 100644 --- a/maintenance_location/__manifest__.py +++ b/maintenance_location/__manifest__.py @@ -5,7 +5,7 @@ "name": "Maintenance Location", "summary": """ Define a location system for maintenance""", - "version": "11.0.1.0.0", + "version": "12.0.1.0.0", "license": "AGPL-3", "author": "Creu Blanca,Odoo Community Association (OCA)", "website": "www.creublanca.es", diff --git a/maintenance_location/models/maintenance_equipment.py b/maintenance_location/models/maintenance_equipment.py index 2a4b1f61a..e4313e5a8 100644 --- a/maintenance_location/models/maintenance_equipment.py +++ b/maintenance_location/models/maintenance_equipment.py @@ -9,6 +9,7 @@ class MaintenanceEquipment(models.Model): _inherit = "maintenance.equipment" location_id = fields.Many2one("maintenance.location") + location = fields.Char(string="Location Old") def _prepare_request_from_plan( self, maintenance_plan, next_maintenance_date diff --git a/maintenance_location/models/maintenance_location.py b/maintenance_location/models/maintenance_location.py index fe52651e7..11e24c5d4 100644 --- a/maintenance_location/models/maintenance_location.py +++ b/maintenance_location/models/maintenance_location.py @@ -1,7 +1,7 @@ # Copyright 2019 Creu Blanca # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, fields, models, _ +from odoo import _, api, fields, models from odoo.exceptions import ValidationError @@ -31,8 +31,7 @@ class MaintenanceLocation(models.Model): child_id = fields.One2many( "maintenance.location", "parent_id", "Child Locations" ) - parent_left = fields.Integer("Left Parent", index=1) - parent_right = fields.Integer("Right Parent", index=1) + parent_path = fields.Char(index=True) sequence = fields.Integer(string="Sequence", default=10) @@ -40,9 +39,8 @@ class MaintenanceLocation(models.Model): def _compute_complete_name(self): for location in self: if location.parent_id: - location.complete_name = "%s / %s" % ( - location.parent_id.complete_name, - location.name, + location.complete_name = "{} / {}".format( + location.parent_id.complete_name, location.name, ) else: location.complete_name = location.name diff --git a/maintenance_location/models/maintenance_request.py b/maintenance_location/models/maintenance_request.py index 442cd1f12..7b8f76dfe 100644 --- a/maintenance_location/models/maintenance_request.py +++ b/maintenance_location/models/maintenance_request.py @@ -12,6 +12,6 @@ class MaintenanceRequest(models.Model): @api.onchange("equipment_id") def _onchange_equipment_id(self): - for record in self.filtered("equipment_id"): - if record.equipment_id.location_id: + for record in self: + if record.equipment_id and record.equipment_id.location_id: record.location_id = record.equipment_id.location_id diff --git a/maintenance_location/tests/test_maintenance_location.py b/maintenance_location/tests/test_maintenance_location.py index 2b338df92..1e8ae1ec6 100644 --- a/maintenance_location/tests/test_maintenance_location.py +++ b/maintenance_location/tests/test_maintenance_location.py @@ -1,13 +1,15 @@ # Copyright 2019 Creu Blanca # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo.tests.common import TransactionCase from odoo.exceptions import ValidationError +from odoo.tests.common import SavepointCase -class TestMaintenanceLocation(TransactionCase): - def setUp(self): - super().setUp() +class TestMaintenanceLocation(SavepointCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + self = cls self.location_1 = self.env["maintenance.location"].create( {"name": "L1"} ) @@ -22,6 +24,22 @@ def setUp(self): {"name": "Request", "maintenance_team_id": self.team.id} ) + self.equipment = self.env["maintenance.equipment"].create( + {"name": "Laptop", "location_id": self.location_1.id} + ) + + self.plan = self.env["maintenance.plan"].create( + { + "equipment_id": self.equipment.id, + "interval": 1, + "interval_step": "month", + "maintenance_plan_horizon": 2, + "planning_step": "month", + "maintenance_team_id": self.team.id, + "location_id": self.location_1.id, + } + ) + def test_maintenance_location(self): self.assertEqual(self.location_2.complete_name, "L1 / L2") with self.assertRaises(ValidationError): @@ -30,3 +48,9 @@ def test_maintenance_location(self): self.request.write({"equipment_id": self.equipment.id}) self.request._onchange_equipment_id() self.assertEqual(self.request.location_id.id, self.location_1.id) + + def test_request_creation(self): + request = self.equipment._create_new_request(self.plan) + self.assertTrue(request) + for r in request: + self.assertEqual(r.location_id.id, self.location_1.id) diff --git a/maintenance_location/views/maintenance_equipment.xml b/maintenance_location/views/maintenance_equipment.xml index 0695778cd..f4fe759b0 100644 --- a/maintenance_location/views/maintenance_equipment.xml +++ b/maintenance_location/views/maintenance_equipment.xml @@ -1,58 +1,63 @@ - + - - maintenance.equipment.form (in maintenance_location) maintenance.equipment - + 1 - + - + - - maintenance.equipment.search (in maintenance_location) + maintenance.equipment.search (in maintenance_location) maintenance.equipment - + - + - maintenance.equipment.tree (in maintenance_location) maintenance.equipment - + - + - maintenance.equipment.tree (in maintenance_location) maintenance.equipment - +
-
+
+ + +
-
diff --git a/maintenance_location/views/maintenance_location.xml b/maintenance_location/views/maintenance_location.xml index d770c8d3a..772ca76ce 100644 --- a/maintenance_location/views/maintenance_location.xml +++ b/maintenance_location/views/maintenance_location.xml @@ -1,47 +1,44 @@ - + - - maintenance.location.form (in cb_maintenance) maintenance.location -
- -
-
- - - -
-
+
+ +
+
+ + + +
+
- maintenance.location.search (in cb_maintenance) maintenance.location - + - maintenance.location.tree (in cb_maintenance) maintenance.location - + - Maintenance Location maintenance.location @@ -49,12 +46,10 @@ [] {} - Maintenance Locations - - - + + + -
diff --git a/maintenance_location/views/maintenance_plan.xml b/maintenance_location/views/maintenance_plan.xml index e53d087f1..e7ccc80ab 100644 --- a/maintenance_location/views/maintenance_plan.xml +++ b/maintenance_location/views/maintenance_plan.xml @@ -1,40 +1,39 @@ - + - - maintenance.plan.form (in maintenance_location) maintenance.plan - + - + - maintenance.plan.search (in maintenance_location) maintenance.plan - + - + - maintenance.plan.tree (in maintenance_location) maintenance.plan - + - + - diff --git a/maintenance_location/views/maintenance_request.xml b/maintenance_location/views/maintenance_request.xml index dc3e182b7..9027b49a3 100644 --- a/maintenance_location/views/maintenance_request.xml +++ b/maintenance_location/views/maintenance_request.xml @@ -1,51 +1,55 @@ - + - - maintenance.request.form (in maintenance_location) maintenance.request - + - + - maintenance.request.search (in maintenance_location) maintenance.request - + - + - maintenance.request.tree (in maintenance_location) maintenance.request - + - + - maintenance.request.kanban (in maintenance_location) maintenance.request - + - - Location :
+ + Location :
-
From 8e5090c33d32885156de109556de7b769ce246f9 Mon Sep 17 00:00:00 2001 From: Olga Marco Date: Fri, 25 Jun 2021 08:44:52 +0200 Subject: [PATCH 03/28] [MIG] maintenance_location: Migration to 13.0 --- maintenance_location/__manifest__.py | 2 +- maintenance_location/models/maintenance_location.py | 3 ++- maintenance_location/tests/test_maintenance_location.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/maintenance_location/__manifest__.py b/maintenance_location/__manifest__.py index 5f764f6e2..37038a15f 100644 --- a/maintenance_location/__manifest__.py +++ b/maintenance_location/__manifest__.py @@ -5,7 +5,7 @@ "name": "Maintenance Location", "summary": """ Define a location system for maintenance""", - "version": "12.0.1.0.0", + "version": "13.0.1.0.0", "license": "AGPL-3", "author": "Creu Blanca,Odoo Community Association (OCA)", "website": "www.creublanca.es", diff --git a/maintenance_location/models/maintenance_location.py b/maintenance_location/models/maintenance_location.py index 11e24c5d4..7ae4f0f02 100644 --- a/maintenance_location/models/maintenance_location.py +++ b/maintenance_location/models/maintenance_location.py @@ -40,7 +40,8 @@ def _compute_complete_name(self): for location in self: if location.parent_id: location.complete_name = "{} / {}".format( - location.parent_id.complete_name, location.name, + location.parent_id.complete_name, + location.name, ) else: location.complete_name = location.name diff --git a/maintenance_location/tests/test_maintenance_location.py b/maintenance_location/tests/test_maintenance_location.py index 1e8ae1ec6..cf94f146d 100644 --- a/maintenance_location/tests/test_maintenance_location.py +++ b/maintenance_location/tests/test_maintenance_location.py @@ -1,7 +1,7 @@ # Copyright 2019 Creu Blanca # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo.exceptions import ValidationError +from odoo.exceptions import UserError from odoo.tests.common import SavepointCase @@ -42,7 +42,7 @@ def setUpClass(cls): def test_maintenance_location(self): self.assertEqual(self.location_2.complete_name, "L1 / L2") - with self.assertRaises(ValidationError): + with self.assertRaises(UserError): self.location_1.write({"parent_id": self.location_2.id}) self.request.write({"equipment_id": self.equipment.id}) From 0d634bdf38c92a311c4371395b8c89913052cf63 Mon Sep 17 00:00:00 2001 From: Kevin Luna Date: Tue, 8 Nov 2022 09:15:19 +0100 Subject: [PATCH 04/28] [IMP] maintenance_location: black, isort, prettier --- maintenance_location/__manifest__.py | 2 +- maintenance_location/models/maintenance_equipment.py | 4 +--- maintenance_location/models/maintenance_location.py | 8 ++------ maintenance_location/tests/test_maintenance_location.py | 4 +--- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/maintenance_location/__manifest__.py b/maintenance_location/__manifest__.py index 37038a15f..291b13bcf 100644 --- a/maintenance_location/__manifest__.py +++ b/maintenance_location/__manifest__.py @@ -8,7 +8,7 @@ "version": "13.0.1.0.0", "license": "AGPL-3", "author": "Creu Blanca,Odoo Community Association (OCA)", - "website": "www.creublanca.es", + "website": "https://github.com/tegin/cb-maintenance", "depends": ["maintenance_plan", "web_widget_child_selector"], "data": [ "views/maintenance_plan.xml", diff --git a/maintenance_location/models/maintenance_equipment.py b/maintenance_location/models/maintenance_equipment.py index e4313e5a8..dca47177b 100644 --- a/maintenance_location/models/maintenance_equipment.py +++ b/maintenance_location/models/maintenance_equipment.py @@ -11,9 +11,7 @@ class MaintenanceEquipment(models.Model): location_id = fields.Many2one("maintenance.location") location = fields.Char(string="Location Old") - def _prepare_request_from_plan( - self, maintenance_plan, next_maintenance_date - ): + def _prepare_request_from_plan(self, maintenance_plan, next_maintenance_date): res = super()._prepare_request_from_plan( maintenance_plan, next_maintenance_date ) diff --git a/maintenance_location/models/maintenance_location.py b/maintenance_location/models/maintenance_location.py index 7ae4f0f02..1328672a6 100644 --- a/maintenance_location/models/maintenance_location.py +++ b/maintenance_location/models/maintenance_location.py @@ -28,9 +28,7 @@ class MaintenanceLocation(models.Model): index=True, ondelete="cascade", ) - child_id = fields.One2many( - "maintenance.location", "parent_id", "Child Locations" - ) + child_id = fields.One2many("maintenance.location", "parent_id", "Child Locations") parent_path = fields.Char(index=True) sequence = fields.Integer(string="Sequence", default=10) @@ -49,7 +47,5 @@ def _compute_complete_name(self): @api.constrains("parent_id") def _check_category_recursion(self): if not self._check_recursion(): - raise ValidationError( - _("Error ! You cannot create recursive Locations.") - ) + raise ValidationError(_("Error ! You cannot create recursive Locations.")) return True diff --git a/maintenance_location/tests/test_maintenance_location.py b/maintenance_location/tests/test_maintenance_location.py index cf94f146d..25b7e8403 100644 --- a/maintenance_location/tests/test_maintenance_location.py +++ b/maintenance_location/tests/test_maintenance_location.py @@ -10,9 +10,7 @@ class TestMaintenanceLocation(SavepointCase): def setUpClass(cls): super().setUpClass() self = cls - self.location_1 = self.env["maintenance.location"].create( - {"name": "L1"} - ) + self.location_1 = self.env["maintenance.location"].create({"name": "L1"}) self.location_2 = self.env["maintenance.location"].create( {"name": "L2", "parent_id": self.location_1.id} ) From 0ccd7c40d11f125abb6de5d7e93da3e47ae01164 Mon Sep 17 00:00:00 2001 From: Kevin Luna Date: Tue, 8 Nov 2022 09:55:44 +0100 Subject: [PATCH 05/28] [MIG] maintenance_location: Migration to 14.0 --- maintenance_location/__manifest__.py | 4 ++-- maintenance_location/views/maintenance_equipment.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/maintenance_location/__manifest__.py b/maintenance_location/__manifest__.py index 291b13bcf..83c4d4f04 100644 --- a/maintenance_location/__manifest__.py +++ b/maintenance_location/__manifest__.py @@ -5,9 +5,9 @@ "name": "Maintenance Location", "summary": """ Define a location system for maintenance""", - "version": "13.0.1.0.0", + "version": "14.0.1.0.0", "license": "AGPL-3", - "author": "Creu Blanca,Odoo Community Association (OCA)", + "author": "CreuBlanca,Odoo Community Association (OCA)", "website": "https://github.com/tegin/cb-maintenance", "depends": ["maintenance_plan", "web_widget_child_selector"], "data": [ diff --git a/maintenance_location/views/maintenance_equipment.xml b/maintenance_location/views/maintenance_equipment.xml index f4fe759b0..0db2c50cf 100644 --- a/maintenance_location/views/maintenance_equipment.xml +++ b/maintenance_location/views/maintenance_equipment.xml @@ -54,7 +54,7 @@
- +
From a1409292c2646e4e36e43058ed3fcd776de2bb16 Mon Sep 17 00:00:00 2001 From: Enric Tobella Date: Fri, 8 Sep 2023 09:38:22 +0200 Subject: [PATCH 06/28] [IMP] maintenance_location: Adapt to OCA --- maintenance_location/README.rst | 80 +++- maintenance_location/__manifest__.py | 2 +- maintenance_location/readme/CONTRIBUTORS.rst | 4 + maintenance_location/readme/DESCRIPTION.rst | 1 + .../static/description/index.html | 424 ++++++++++++++++++ .../views/maintenance_equipment.xml | 2 +- .../views/maintenance_request.xml | 6 +- 7 files changed, 513 insertions(+), 6 deletions(-) create mode 100644 maintenance_location/readme/CONTRIBUTORS.rst create mode 100644 maintenance_location/readme/DESCRIPTION.rst create mode 100644 maintenance_location/static/description/index.html diff --git a/maintenance_location/README.rst b/maintenance_location/README.rst index af276a928..11f55be69 100644 --- a/maintenance_location/README.rst +++ b/maintenance_location/README.rst @@ -1 +1,79 @@ -Define a location system for maintenance +==================== +Maintenance Location +==================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:2488123f61dfac3fdb543b1094f3ed92ad84a27c14af2520512ea4475d27ec7a + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/14.0/maintenance_location + :alt: OCA/maintenance +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/maintenance-14-0/maintenance-14-0-maintenance_location + :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=14.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Define a location system with hierarchy for maintenance equipments and 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 +~~~~~~~ + +* CreuBlanca + +Contributors +~~~~~~~~~~~~ + +* CreuBlanca + * Enric Tobella + * Kevin Luna + * Jaime Arroyo + +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/__manifest__.py b/maintenance_location/__manifest__.py index 83c4d4f04..a51908612 100644 --- a/maintenance_location/__manifest__.py +++ b/maintenance_location/__manifest__.py @@ -8,7 +8,7 @@ "version": "14.0.1.0.0", "license": "AGPL-3", "author": "CreuBlanca,Odoo Community Association (OCA)", - "website": "https://github.com/tegin/cb-maintenance", + "website": "https://github.com/OCA/maintenance", "depends": ["maintenance_plan", "web_widget_child_selector"], "data": [ "views/maintenance_plan.xml", diff --git a/maintenance_location/readme/CONTRIBUTORS.rst b/maintenance_location/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..3221219fa --- /dev/null +++ b/maintenance_location/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* CreuBlanca + * Enric Tobella + * Kevin Luna + * Jaime Arroyo diff --git a/maintenance_location/readme/DESCRIPTION.rst b/maintenance_location/readme/DESCRIPTION.rst new file mode 100644 index 000000000..6b5f20983 --- /dev/null +++ b/maintenance_location/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Define a location system with hierarchy for maintenance equipments and requests. diff --git a/maintenance_location/static/description/index.html b/maintenance_location/static/description/index.html new file mode 100644 index 000000000..5c6097715 --- /dev/null +++ b/maintenance_location/static/description/index.html @@ -0,0 +1,424 @@ + + + + + + +Maintenance Location + + + +
+

Maintenance Location

+ + +

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

+

Define a location system with hierarchy for maintenance equipments and 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

+
    +
  • CreuBlanca
  • +
+
+
+

Contributors

+
    +
  • CreuBlanca +* Enric Tobella +* Kevin Luna +* Jaime Arroyo
  • +
+
+
+

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/views/maintenance_equipment.xml b/maintenance_location/views/maintenance_equipment.xml index 0db2c50cf..db04ee6f1 100644 --- a/maintenance_location/views/maintenance_equipment.xml +++ b/maintenance_location/views/maintenance_equipment.xml @@ -32,7 +32,7 @@ maintenance.equipment - + diff --git a/maintenance_location/views/maintenance_request.xml b/maintenance_location/views/maintenance_request.xml index 9027b49a3..1a2cc48b0 100644 --- a/maintenance_location/views/maintenance_request.xml +++ b/maintenance_location/views/maintenance_request.xml @@ -7,7 +7,7 @@ maintenance.request - + maintenance.request - + Location :
-
+
From 178a0f4c2bfe0c35e58fb06ec2b2d97feaef3f81 Mon Sep 17 00:00:00 2001 From: Enric Tobella Date: Fri, 8 Sep 2023 12:15:24 +0200 Subject: [PATCH 07/28] [IMP] maintenance_location: Add new fields and behavior, remove widget_selection dependency --- maintenance_location/__manifest__.py | 2 +- maintenance_location/models/maintenance_equipment.py | 2 +- maintenance_location/models/maintenance_location.py | 5 ++++- maintenance_location/views/maintenance_equipment.xml | 10 +++------- maintenance_location/views/maintenance_location.xml | 6 ++++++ maintenance_location/views/maintenance_plan.xml | 6 +----- maintenance_location/views/maintenance_request.xml | 8 ++------ 7 files changed, 18 insertions(+), 21 deletions(-) diff --git a/maintenance_location/__manifest__.py b/maintenance_location/__manifest__.py index a51908612..d4246c01b 100644 --- a/maintenance_location/__manifest__.py +++ b/maintenance_location/__manifest__.py @@ -9,7 +9,7 @@ "license": "AGPL-3", "author": "CreuBlanca,Odoo Community Association (OCA)", "website": "https://github.com/OCA/maintenance", - "depends": ["maintenance_plan", "web_widget_child_selector"], + "depends": ["maintenance_plan"], "data": [ "views/maintenance_plan.xml", "views/maintenance_equipment.xml", diff --git a/maintenance_location/models/maintenance_equipment.py b/maintenance_location/models/maintenance_equipment.py index dca47177b..7614226c7 100644 --- a/maintenance_location/models/maintenance_equipment.py +++ b/maintenance_location/models/maintenance_equipment.py @@ -8,7 +8,7 @@ class MaintenanceEquipment(models.Model): _inherit = "maintenance.equipment" - location_id = fields.Many2one("maintenance.location") + location_id = fields.Many2one("maintenance.location", tracking=True) location = fields.Char(string="Location Old") def _prepare_request_from_plan(self, maintenance_plan, next_maintenance_date): diff --git a/maintenance_location/models/maintenance_location.py b/maintenance_location/models/maintenance_location.py index 1328672a6..749778cb8 100644 --- a/maintenance_location/models/maintenance_location.py +++ b/maintenance_location/models/maintenance_location.py @@ -16,6 +16,7 @@ class MaintenanceLocation(models.Model): _order = "complete_name,id" name = fields.Char(required=True) + description = fields.Char() complete_name = fields.Char( "Complete Name", compute="_compute_complete_name", store=True ) @@ -30,8 +31,10 @@ class MaintenanceLocation(models.Model): ) child_id = fields.One2many("maintenance.location", "parent_id", "Child Locations") parent_path = fields.Char(index=True) - + latitude = fields.Float(digits=(16, 5)) + longitude = fields.Float(digits=(16, 5)) sequence = fields.Integer(string="Sequence", default=10) + active = fields.Boolean(default=True) @api.depends("name", "parent_id.complete_name") def _compute_complete_name(self): diff --git a/maintenance_location/views/maintenance_equipment.xml b/maintenance_location/views/maintenance_equipment.xml index db04ee6f1..d4c3e431f 100644 --- a/maintenance_location/views/maintenance_equipment.xml +++ b/maintenance_location/views/maintenance_equipment.xml @@ -10,13 +10,9 @@ 1 - - - + + + + + diff --git a/maintenance_location/views/maintenance_plan.xml b/maintenance_location/views/maintenance_plan.xml index e7ccc80ab..ba44e49c9 100644 --- a/maintenance_location/views/maintenance_plan.xml +++ b/maintenance_location/views/maintenance_plan.xml @@ -8,11 +8,7 @@ - + diff --git a/maintenance_location/views/maintenance_request.xml b/maintenance_location/views/maintenance_request.xml index 1a2cc48b0..6538f7eed 100644 --- a/maintenance_location/views/maintenance_request.xml +++ b/maintenance_location/views/maintenance_request.xml @@ -8,11 +8,7 @@ - + @@ -35,7 +31,7 @@ - + From cda39d045e88bf27366affefc0b2a8f8f972111a Mon Sep 17 00:00:00 2001 From: oca-ci Date: Mon, 11 Dec 2023 08:55:58 +0000 Subject: [PATCH 08/28] [UPD] Update maintenance_location.pot --- maintenance_location/README.rst | 2 +- .../i18n/maintenance_location.pot | 121 +++++++++++++----- .../static/description/index.html | 31 +++-- 3 files changed, 104 insertions(+), 50 deletions(-) diff --git a/maintenance_location/README.rst b/maintenance_location/README.rst index 11f55be69..a4b91e8ff 100644 --- a/maintenance_location/README.rst +++ b/maintenance_location/README.rst @@ -7,7 +7,7 @@ Maintenance Location !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:2488123f61dfac3fdb543b1094f3ed92ad84a27c14af2520512ea4475d27ec7a + !! source digest: sha256:4bbadc3f945366acbd515935feaf10cdb5bb59efbfb63117a8fa5d17268cda05 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/maintenance_location/i18n/maintenance_location.pot b/maintenance_location/i18n/maintenance_location.pot index ec990dd3a..609e73f10 100644 --- a/maintenance_location/i18n/maintenance_location.pot +++ b/maintenance_location/i18n/maintenance_location.pot @@ -1,14 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * maintenance_location +# * maintenance_location # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 11.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-12-12 11:56+0000\n" -"PO-Revision-Date: 2019-12-12 11:56+0000\n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -16,82 +14,130 @@ msgstr "" "Plural-Forms: \n" #. module: maintenance_location -#: model:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view -msgid "Location name" +#: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +msgid "" +"
\n" +" Longitude:" +msgstr "" + +#. module: maintenance_location +#: model_terms:ir.ui.view,arch_db:maintenance_location.hr_equipment_view_kanban +msgid "" msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_child_id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__active +msgid "Active" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__child_id msgid "Child Locations" msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_complete_name +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__complete_name msgid "Complete Name" msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_create_uid +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__create_uid msgid "Created by" msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_create_date +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__create_date msgid "Created on" msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_display_name -msgid "Display Name" +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__description +msgid "Description" msgstr "" #. module: maintenance_location -#: model:ir.model,name:maintenance_location.model_maintenance_equipment -msgid "Equipment" +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_equipment__display_name +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__display_name +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_plan__display_name +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_request__display_name +msgid "Display Name" msgstr "" #. module: maintenance_location -#: code:addons/maintenance_location/models/maintenance_location.py:52 +#: code:addons/maintenance_location/models/maintenance_location.py:0 #, python-format msgid "Error ! You cannot create recursive Locations." msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_equipment__id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_plan__id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_request__id msgid "ID" msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location___last_update +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_equipment____last_update +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location____last_update +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_plan____last_update +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_request____last_update msgid "Last Modified on" msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_write_uid +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__write_uid msgid "Last Updated by" msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_write_date +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__write_date msgid "Last Updated on" msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_parent_left -msgid "Left Parent" +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__latitude +msgid "Latitude" +msgstr "" + +#. module: maintenance_location +#: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +msgid "Latitude:" msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_equipment_location_id -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_request_location_id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_equipment__location_id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_plan__location_id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_request__location_id +#: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view msgid "Location" msgstr "" #. module: maintenance_location -#: model:ir.ui.view,arch_db:maintenance_location.hr_equipment_request_view_kanban +#: model_terms:ir.ui.view,arch_db:maintenance_location.hr_equipment_request_view_kanban msgid "Location :" msgstr "" +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_equipment__location +msgid "Location Old" +msgstr "" + +#. module: maintenance_location +#: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +msgid "Location name" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__longitude +msgid "Longitude" +msgstr "" + +#. module: maintenance_location +#: model:ir.model,name:maintenance_location.model_maintenance_equipment +msgid "Maintenance Equipment" +msgstr "" + #. module: maintenance_location #: model:ir.actions.act_window,name:maintenance_location.maintenance_location_act_window #: model:ir.model,name:maintenance_location.model_maintenance_location @@ -103,33 +149,42 @@ msgstr "" msgid "Maintenance Locations" msgstr "" +#. module: maintenance_location +#: model:ir.model,name:maintenance_location.model_maintenance_plan +msgid "Maintenance Plan" +msgstr "" + #. module: maintenance_location #: model:ir.model,name:maintenance_location.model_maintenance_request -msgid "Maintenance Requests" +msgid "Maintenance Request" msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_name +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__name msgid "Name" msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_parent_id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__parent_id msgid "Parent Location" msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_partner_id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__parent_path +msgid "Parent Path" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__partner_id msgid "Partner" msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_parent_right -msgid "Right Parent" +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__sequence +msgid "Sequence" msgstr "" #. module: maintenance_location -#: model:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +#: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view msgid "e.g. Building A" msgstr "" - diff --git a/maintenance_location/static/description/index.html b/maintenance_location/static/description/index.html index 5c6097715..5ea2f7fbc 100644 --- a/maintenance_location/static/description/index.html +++ b/maintenance_location/static/description/index.html @@ -1,20 +1,19 @@ - - + Maintenance Location -
-

Maintenance Location

+
+ + +Odoo Community Association + +
+

Maintenance Location

-

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

+

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

Define a location system with hierarchy for maintenance equipments and requests.

Table of contents

@@ -385,7 +390,7 @@

Maintenance Location

-

Bug Tracker

+

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 @@ -393,16 +398,16 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • CreuBlanca
  • Dixmit
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -433,5 +438,6 @@

Maintainers

+
From 8d2a8954069cdf8ab7304a72321ed16e1c8ef90b Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Wed, 11 Mar 2026 12:54:56 +0100 Subject: [PATCH 17/28] [IMP] maintenance_location: Add inverse relation and equipment count to locations --- .../models/maintenance_location.py | 46 +++++++++++++++++++ .../tests/test_maintenance_location.py | 19 ++++++-- .../views/maintenance_location.xml | 29 +++++++++--- 3 files changed, 84 insertions(+), 10 deletions(-) diff --git a/maintenance_location/models/maintenance_location.py b/maintenance_location/models/maintenance_location.py index cd72a3914..e90a00dcf 100644 --- a/maintenance_location/models/maintenance_location.py +++ b/maintenance_location/models/maintenance_location.py @@ -34,6 +34,52 @@ class MaintenanceLocation(models.Model): longitude = fields.Float(digits=(16, 5)) sequence = fields.Integer(default=10) active = fields.Boolean(default=True) + equipment_ids = fields.One2many( + "maintenance.equipment", "location_id", string="Equipments" + ) + child_equipment_ids = fields.Many2many( + comodel_name="maintenance.equipment", + compute="_compute_child_equipment_ids", + string="Child Equipments", + ) + equipment_count = fields.Integer(compute="_compute_equipment_count") + + def _compute_child_equipment_ids(self): + all_locations = self.env["maintenance.location"].search( + [("id", "child_of", self.ids)] + ) + all_equipments = self.env["maintenance.equipment"].search( + [("location_id", "in", all_locations.ids)] + ) + for location in self: + descendant_locs = all_locations.filtered( + lambda sub_loc, loc=location: sub_loc.parent_path + and sub_loc.parent_path.startswith(loc.parent_path) + and sub_loc.id != loc.id + ) + location.child_equipment_ids = all_equipments.filtered( + lambda eq, d_locs=descendant_locs: eq.location_id in d_locs + ) + + def _compute_equipment_count(self): + all_locations = self.env["maintenance.location"].search( + [("id", "child_of", self.ids)] + ) + equip_data = self.env["maintenance.equipment"].read_group( + domain=[("location_id", "in", all_locations.ids)], + fields=["location_id"], + groupby=["location_id"], + ) + count_dict = {x["location_id"][0]: x["location_id_count"] for x in equip_data} + for location in self: + descendant_ids = all_locations.filtered( + lambda sub_loc, loc=location: sub_loc.parent_path + and sub_loc.parent_path.startswith(loc.parent_path) + ).ids + + location.equipment_count = sum( + count_dict.get(d_id, 0) for d_id in descendant_ids + ) @api.depends("name", "parent_id.complete_name") def _compute_complete_name(self): diff --git a/maintenance_location/tests/test_maintenance_location.py b/maintenance_location/tests/test_maintenance_location.py index 4305a5dad..9cafa026f 100644 --- a/maintenance_location/tests/test_maintenance_location.py +++ b/maintenance_location/tests/test_maintenance_location.py @@ -21,11 +21,15 @@ def setUpClass(cls): self.request = self.env["maintenance.request"].create( {"name": "Request", "maintenance_team_id": self.team.id} ) - - self.equipment = self.env["maintenance.equipment"].create( + self.env["maintenance.equipment"].create( {"name": "Laptop", "location_id": self.location_1.id} ) - + self.env["maintenance.equipment"].create( + {"name": "Printer", "location_id": self.location_1.id} + ) + self.env["maintenance.equipment"].create( + {"name": "Scanner", "location_id": self.location_2.id} + ) self.plan = self.env["maintenance.plan"].create( { "equipment_id": self.equipment.id, @@ -37,6 +41,7 @@ def setUpClass(cls): "location_id": self.location_1.id, } ) + self.env.invalidate_all() def test_maintenance_location(self): self.assertEqual(self.location_2.complete_name, "L1 / L2") @@ -51,3 +56,11 @@ def test_request_creation(self): self.assertTrue(request) for r in request: self.assertEqual(r.location_id.id, self.location_1.id) + + def test_count_equipment(self): + self.assertEqual(self.location_1.equipment_count, 4) + self.assertEqual(self.location_2.equipment_count, 1) + + def test_child_equipment_ids(self): + self.assertEqual(len(self.location_1.child_equipment_ids), 1) + self.assertEqual(len(self.location_2.child_equipment_ids), 0) diff --git a/maintenance_location/views/maintenance_location.xml b/maintenance_location/views/maintenance_location.xml index 311d11c8b..e58ff8860 100644 --- a/maintenance_location/views/maintenance_location.xml +++ b/maintenance_location/views/maintenance_location.xml @@ -15,13 +15,27 @@ - - - @@ -42,6 +56,7 @@ + From 5f2bc1494af79b5c595954f2fff689034dd70fe6 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Wed, 29 Apr 2026 11:45:34 +0000 Subject: [PATCH 18/28] [UPD] Update maintenance_location.pot --- .../i18n/maintenance_location.pot | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/maintenance_location/i18n/maintenance_location.pot b/maintenance_location/i18n/maintenance_location.pot index fcab2f9ff..7d6107b61 100644 --- a/maintenance_location/i18n/maintenance_location.pot +++ b/maintenance_location/i18n/maintenance_location.pot @@ -17,7 +17,7 @@ msgstr "" #: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view msgid "" "
\n" -" Longitude:" +" Longitude:" msgstr "" #. module: maintenance_location @@ -30,6 +30,12 @@ msgstr "" msgid "Active" msgstr "" +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__child_equipment_ids +#: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +msgid "Child Equipments" +msgstr "" + #. module: maintenance_location #: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__child_id msgid "Child Locations" @@ -60,6 +66,17 @@ msgstr "" msgid "Display Name" msgstr "" +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__equipment_count +msgid "Equipment Count" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__equipment_ids +#: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +msgid "Equipments" +msgstr "" + #. module: maintenance_location #. odoo-python #: code:addons/maintenance_location/models/maintenance_location.py:0 From f6327901bb2e2e0478e7f3b154013715151cb4d8 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Wed, 29 Apr 2026 11:48:34 +0000 Subject: [PATCH 19/28] [BOT] post-merge updates --- maintenance_location/README.rst | 2 +- maintenance_location/__manifest__.py | 2 +- maintenance_location/static/description/index.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/maintenance_location/README.rst b/maintenance_location/README.rst index e71ea29af..4f1ddfdae 100644 --- a/maintenance_location/README.rst +++ b/maintenance_location/README.rst @@ -11,7 +11,7 @@ Maintenance Location !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:a2caa69cdd2b23704424558561a62b4ec0b4057a8d75594e0367262ef16364ed + !! source digest: sha256:8c8c6f926ab0925c0f8407dba57714d9a272dd8e3cc66f0a777ac466d84d69e5 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/maintenance_location/__manifest__.py b/maintenance_location/__manifest__.py index df89d39db..ddb8483b4 100644 --- a/maintenance_location/__manifest__.py +++ b/maintenance_location/__manifest__.py @@ -5,7 +5,7 @@ "name": "Maintenance Location", "summary": """ Define a location system for maintenance""", - "version": "17.0.1.0.0", + "version": "17.0.1.1.0", "license": "AGPL-3", "author": "CreuBlanca, Dixmit,Odoo Community Association (OCA)", "website": "https://github.com/OCA/maintenance", diff --git a/maintenance_location/static/description/index.html b/maintenance_location/static/description/index.html index 556f49033..ad83276b2 100644 --- a/maintenance_location/static/description/index.html +++ b/maintenance_location/static/description/index.html @@ -372,7 +372,7 @@

Maintenance Location

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:a2caa69cdd2b23704424558561a62b4ec0b4057a8d75594e0367262ef16364ed +!! source digest: sha256:8c8c6f926ab0925c0f8407dba57714d9a272dd8e3cc66f0a777ac466d84d69e5 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

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

Define a location system with hierarchy for maintenance equipments and From a34d6f33e13b3c9833509802873dab91c1936e71 Mon Sep 17 00:00:00 2001 From: Weblate Date: Wed, 29 Apr 2026 11:48:42 +0000 Subject: [PATCH 20/28] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: maintenance-17.0/maintenance-17.0-maintenance_location Translate-URL: https://translation.odoo-community.org/projects/maintenance-17-0/maintenance-17-0-maintenance_location/ --- maintenance_location/i18n/es.po | 149 ++++++++++++++++++++++++-------- maintenance_location/i18n/it.po | 46 ++++++---- 2 files changed, 142 insertions(+), 53 deletions(-) diff --git a/maintenance_location/i18n/es.po b/maintenance_location/i18n/es.po index 4e3f9dd5e..a52554601 100644 --- a/maintenance_location/i18n/es.po +++ b/maintenance_location/i18n/es.po @@ -10,90 +10,142 @@ msgstr "" "PO-Revision-Date: 2019-12-12 13:00+0100\n" "Last-Translator: <>\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: \n" -"Language: es\n" "X-Generator: Poedit 2.0.6\n" #. module: maintenance_location -#: model:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view -msgid "Location name" -msgstr "Nombre de la ubicación" +#: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +msgid "" +"
\n" +" Longitude:" +msgstr "" + +#. module: maintenance_location +#: model_terms:ir.ui.view,arch_db:maintenance_location.hr_equipment_view_kanban +msgid "" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__active +msgid "Active" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__child_equipment_ids +#: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +msgid "Child Equipments" +msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_child_id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__child_id msgid "Child Locations" msgstr "Ubicaciones Hijas" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_complete_name +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__complete_name msgid "Complete Name" msgstr "Nombre completo" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_create_uid +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__create_uid msgid "Created by" msgstr "Creado por" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_create_date +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__create_date msgid "Created on" msgstr "Creado en" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_display_name +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__description +msgid "Description" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__display_name msgid "Display Name" msgstr "Nombre mostrado" #. module: maintenance_location -#: model:ir.model,name:maintenance_location.model_maintenance_equipment -msgid "Equipment" -msgstr "Equipamiento" +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__equipment_count +msgid "Equipment Count" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__equipment_ids +#: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +msgid "Equipments" +msgstr "" #. module: maintenance_location -#: code:addons/maintenance_location/models/maintenance_location.py:52 +#. odoo-python +#: code:addons/maintenance_location/models/maintenance_location.py:0 #, python-format msgid "Error ! You cannot create recursive Locations." msgstr "Error! No puedes crear ubicaciones cíclicas." #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__id msgid "ID" msgstr "ID (identificación)" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location___last_update -msgid "Last Modified on" -msgstr "Última modificación en" - -#. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_write_uid +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__write_uid msgid "Last Updated by" msgstr "Última actualización de" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_write_date +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__write_date msgid "Last Updated on" msgstr "Última actualización en" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_parent_left -msgid "Left Parent" -msgstr "Padre izquierdo" +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__latitude +msgid "Latitude" +msgstr "" + +#. module: maintenance_location +#: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +msgid "Latitude:" +msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_equipment_location_id -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_request_location_id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_equipment__location_id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_plan__location_id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_request__location_id +#: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view msgid "Location" msgstr "Ubicación" #. module: maintenance_location -#: model:ir.ui.view,arch_db:maintenance_location.hr_equipment_request_view_kanban +#: model_terms:ir.ui.view,arch_db:maintenance_location.hr_equipment_request_view_kanban msgid "Location :" msgstr "Location :" +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_equipment__location +msgid "Location Old" +msgstr "" + +#. module: maintenance_location +#: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +msgid "Location name" +msgstr "Nombre de la ubicación" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__longitude +msgid "Longitude" +msgstr "" + +#. module: maintenance_location +#: model:ir.model,name:maintenance_location.model_maintenance_equipment +msgid "Maintenance Equipment" +msgstr "" + #. module: maintenance_location #: model:ir.actions.act_window,name:maintenance_location.maintenance_location_act_window #: model:ir.model,name:maintenance_location.model_maintenance_location @@ -105,32 +157,57 @@ msgstr "Ubicación" msgid "Maintenance Locations" msgstr "Ubicaciones" +#. module: maintenance_location +#: model:ir.model,name:maintenance_location.model_maintenance_plan +msgid "Maintenance Plan" +msgstr "" + #. module: maintenance_location #: model:ir.model,name:maintenance_location.model_maintenance_request -msgid "Maintenance Requests" -msgstr "Peticiones de mantenimiento" +msgid "Maintenance Request" +msgstr "" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_name +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__name msgid "Name" msgstr "Nombre" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_parent_id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__parent_id msgid "Parent Location" msgstr "Ubicación padre" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_partner_id +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__parent_path +msgid "Parent Path" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__partner_id msgid "Partner" msgstr "Centro" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location_parent_right -msgid "Right Parent" -msgstr "Padre derecho" +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__sequence +msgid "Sequence" +msgstr "" #. module: maintenance_location -#: model:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +#: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view msgid "e.g. Building A" msgstr "p.e. Edificio A" + +#~ msgid "Equipment" +#~ msgstr "Equipamiento" + +#~ msgid "Last Modified on" +#~ msgstr "Última modificación en" + +#~ msgid "Left Parent" +#~ msgstr "Padre izquierdo" + +#~ msgid "Maintenance Requests" +#~ msgstr "Peticiones de mantenimiento" + +#~ msgid "Right Parent" +#~ msgstr "Padre derecho" diff --git a/maintenance_location/i18n/it.po b/maintenance_location/i18n/it.po index e20f612ca..336b619ea 100644 --- a/maintenance_location/i18n/it.po +++ b/maintenance_location/i18n/it.po @@ -20,10 +20,8 @@ msgstr "" #: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view msgid "" "
\n" -" Longitude:" +" Longitude:" msgstr "" -"
\n" -" Longitudine:" #. module: maintenance_location #: model_terms:ir.ui.view,arch_db:maintenance_location.hr_equipment_view_kanban @@ -35,6 +33,12 @@ msgstr "" msgid "Active" msgstr "Attiva" +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__child_equipment_ids +#: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +msgid "Child Equipments" +msgstr "" + #. module: maintenance_location #: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__child_id msgid "Child Locations" @@ -61,35 +65,33 @@ msgid "Description" msgstr "Descrizione" #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_equipment__display_name #: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__display_name -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_plan__display_name -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_request__display_name msgid "Display Name" msgstr "Nome visualizzato" #. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__equipment_count +msgid "Equipment Count" +msgstr "" + +#. module: maintenance_location +#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__equipment_ids +#: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view +msgid "Equipments" +msgstr "" + +#. module: maintenance_location +#. odoo-python #: code:addons/maintenance_location/models/maintenance_location.py:0 #, python-format msgid "Error ! You cannot create recursive Locations." msgstr "Errore! Non è possibile creare ubicazioni ricorsive." #. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_equipment__id #: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__id -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_plan__id -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_request__id msgid "ID" msgstr "ID" -#. module: maintenance_location -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_equipment____last_update -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location____last_update -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_plan____last_update -#: model:ir.model.fields,field_description:maintenance_location.field_maintenance_request____last_update -msgid "Last Modified on" -msgstr "Ultima modifica il" - #. module: maintenance_location #: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__write_uid msgid "Last Updated by" @@ -193,3 +195,13 @@ msgstr "Sequenza" #: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view msgid "e.g. Building A" msgstr "e.g. Fabbricato A" + +#~ msgid "" +#~ "
\n" +#~ " Longitude:" +#~ msgstr "" +#~ "
\n" +#~ " Longitudine:" + +#~ msgid "Last Modified on" +#~ msgstr "Ultima modifica il" From 44e59087fb54131a23c11afd5f34d301a37e3304 Mon Sep 17 00:00:00 2001 From: mymage Date: Thu, 30 Apr 2026 08:12:28 +0000 Subject: [PATCH 21/28] Translated using Weblate (Italian) Currently translated at 100.0% (34 of 34 strings) Translation: maintenance-17.0/maintenance-17.0-maintenance_location Translate-URL: https://translation.odoo-community.org/projects/maintenance-17-0/maintenance-17-0-maintenance_location/it/ --- maintenance_location/i18n/it.po | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/maintenance_location/i18n/it.po b/maintenance_location/i18n/it.po index 336b619ea..879828eab 100644 --- a/maintenance_location/i18n/it.po +++ b/maintenance_location/i18n/it.po @@ -6,7 +6,7 @@ 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" +"PO-Revision-Date: 2026-04-30 10:45+0000\n" "Last-Translator: mymage \n" "Language-Team: none\n" "Language: it\n" @@ -14,7 +14,7 @@ msgstr "" "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" +"X-Generator: Weblate 5.15.2\n" #. module: maintenance_location #: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view @@ -22,6 +22,8 @@ msgid "" "
\n" " Longitude:" msgstr "" +"
\n" +" Longitudine:" #. module: maintenance_location #: model_terms:ir.ui.view,arch_db:maintenance_location.hr_equipment_view_kanban @@ -37,7 +39,7 @@ msgstr "Attiva" #: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__child_equipment_ids #: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view msgid "Child Equipments" -msgstr "" +msgstr "Attrezzature figlie" #. module: maintenance_location #: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__child_id @@ -72,13 +74,13 @@ msgstr "Nome visualizzato" #. module: maintenance_location #: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__equipment_count msgid "Equipment Count" -msgstr "" +msgstr "Conteggio attrezzature" #. module: maintenance_location #: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__equipment_ids #: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view msgid "Equipments" -msgstr "" +msgstr "Attrezzature" #. module: maintenance_location #. odoo-python From f538cdc17d7d15bf81fbe96e37d2ec2e5de264bf Mon Sep 17 00:00:00 2001 From: Yann Papouin Date: Mon, 4 May 2026 09:46:11 +0200 Subject: [PATCH 22/28] [IMP] maintenance_location: pre-commit auto fixes --- maintenance_location/models/maintenance_location.py | 5 ++--- maintenance_location/views/maintenance_location.xml | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/maintenance_location/models/maintenance_location.py b/maintenance_location/models/maintenance_location.py index e90a00dcf..e3005bf82 100644 --- a/maintenance_location/models/maintenance_location.py +++ b/maintenance_location/models/maintenance_location.py @@ -85,9 +85,8 @@ def _compute_equipment_count(self): def _compute_complete_name(self): for location in self: if location.parent_id: - location.complete_name = "{} / {}".format( - location.parent_id.complete_name, - location.name, + location.complete_name = ( + f"{location.parent_id.complete_name} / {location.name}" ) else: location.complete_name = location.name diff --git a/maintenance_location/views/maintenance_location.xml b/maintenance_location/views/maintenance_location.xml index e58ff8860..7d2392bc9 100644 --- a/maintenance_location/views/maintenance_location.xml +++ b/maintenance_location/views/maintenance_location.xml @@ -25,12 +25,12 @@ - - Date: Mon, 4 May 2026 09:46:30 +0200 Subject: [PATCH 23/28] [MIG] maintenance_location: Migration to 18.0 --- maintenance_location/README.rst | 16 ++++------- maintenance_location/__manifest__.py | 2 +- .../models/maintenance_location.py | 10 ++++--- .../models/maintenance_request.py | 16 ++++++++--- .../static/description/index.html | 28 ++++++++----------- .../tests/test_maintenance_location.py | 16 +++++++++++ .../views/maintenance_equipment.xml | 12 ++++---- .../views/maintenance_location.xml | 7 +++-- .../views/maintenance_request.xml | 2 +- 9 files changed, 64 insertions(+), 45 deletions(-) diff --git a/maintenance_location/README.rst b/maintenance_location/README.rst index 4f1ddfdae..b208bc0ab 100644 --- a/maintenance_location/README.rst +++ b/maintenance_location/README.rst @@ -1,7 +1,3 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - ==================== Maintenance Location ==================== @@ -17,17 +13,17 @@ Maintenance Location .. |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 +.. |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_location + :target: https://github.com/OCA/maintenance/tree/18.0/maintenance_location :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_location + :target: https://translation.odoo-community.org/projects/maintenance-18-0/maintenance-18-0-maintenance_location :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 + :target: https://runboat.odoo-community.org/builds?repo=OCA/maintenance&target_branch=18.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -46,7 +42,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -88,6 +84,6 @@ 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. +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/__manifest__.py b/maintenance_location/__manifest__.py index ddb8483b4..0a081252c 100644 --- a/maintenance_location/__manifest__.py +++ b/maintenance_location/__manifest__.py @@ -5,7 +5,7 @@ "name": "Maintenance Location", "summary": """ Define a location system for maintenance""", - "version": "17.0.1.1.0", + "version": "18.0.1.0.0", "license": "AGPL-3", "author": "CreuBlanca, Dixmit,Odoo Community Association (OCA)", "website": "https://github.com/OCA/maintenance", diff --git a/maintenance_location/models/maintenance_location.py b/maintenance_location/models/maintenance_location.py index e3005bf82..76671a0a7 100644 --- a/maintenance_location/models/maintenance_location.py +++ b/maintenance_location/models/maintenance_location.py @@ -1,7 +1,7 @@ # Copyright 2019 Creu Blanca # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.exceptions import ValidationError @@ -29,7 +29,7 @@ class MaintenanceLocation(models.Model): ondelete="cascade", ) child_id = fields.One2many("maintenance.location", "parent_id", "Child Locations") - parent_path = fields.Char(index=True, unaccent=False) + parent_path = fields.Char(index=True) latitude = fields.Float(digits=(16, 5)) longitude = fields.Float(digits=(16, 5)) sequence = fields.Integer(default=10) @@ -93,6 +93,8 @@ def _compute_complete_name(self): @api.constrains("parent_id") def _check_category_recursion(self): - if not self._check_recursion(): - raise ValidationError(_("Error ! You cannot create recursive Locations.")) + if self._has_cycle(): + raise ValidationError( + self.env._("Error ! You cannot create recursive Locations.") + ) return True diff --git a/maintenance_location/models/maintenance_request.py b/maintenance_location/models/maintenance_request.py index 94c1fd8dd..cfd55c4b6 100644 --- a/maintenance_location/models/maintenance_request.py +++ b/maintenance_location/models/maintenance_request.py @@ -9,13 +9,21 @@ class MaintenanceRequest(models.Model): location_id = fields.Many2one( "maintenance.location", - compute="_compute_equipment_id", + compute="_compute_location_id", store=True, readonly=False, ) - @api.depends("equipment_id") - def _compute_equipment_id(self): + @api.depends( + "equipment_id", "equipment_id.location_id", "stage_id", "stage_id.done" + ) + def _compute_location_id(self): for record in self: if record.equipment_id and record.equipment_id.location_id: - record.location_id = record.equipment_id.location_id + if record.stage_id and record.stage_id.done: + # if the request is done, we want keep existing location + pass + else: + record.location_id = record.equipment_id.location_id + else: + record.location_id = False diff --git a/maintenance_location/static/description/index.html b/maintenance_location/static/description/index.html index ad83276b2..2d4f525cd 100644 --- a/maintenance_location/static/description/index.html +++ b/maintenance_location/static/description/index.html @@ -3,7 +3,7 @@ -README.rst +Maintenance Location -

+
+

Maintenance Location

- - -Odoo Community Association - -
-

Maintenance Location

-

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

+

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

Define a location system with hierarchy for maintenance equipments and requests.

Table of contents

@@ -390,24 +385,24 @@

Maintenance Location

-

Bug Tracker

+

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.

+feedback.

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • CreuBlanca
  • Dixmit
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -433,11 +428,10 @@

Maintainers

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.

+

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/tests/test_maintenance_location.py b/maintenance_location/tests/test_maintenance_location.py index 9cafa026f..bd0dd424e 100644 --- a/maintenance_location/tests/test_maintenance_location.py +++ b/maintenance_location/tests/test_maintenance_location.py @@ -50,6 +50,22 @@ def test_maintenance_location(self): self.request.write({"equipment_id": self.equipment.id}) self.assertEqual(self.request.location_id.id, self.location_1.id) + # change equipment location and check that request location is updated + self.equipment.location_id = self.location_2 + self.request.invalidate_recordset() + self.assertEqual(self.request.location_id.id, self.location_2.id) + + def test_request_location_not_updated_when_stage_done(self): + self.request.write({"equipment_id": self.equipment.id}) + self.assertEqual(self.request.location_id.id, self.location_1.id) + done_stage = self.env["maintenance.stage"].create( + {"name": "Done", "done": True} + ) + self.request.stage_id = done_stage + # change equipment location and check that request location is NOT updated + self.equipment.location_id = self.location_2 + self.request.invalidate_recordset() + self.assertEqual(self.request.location_id.id, self.location_1.id) def test_request_creation(self): request = self.equipment._create_new_request(self.plan) diff --git a/maintenance_location/views/maintenance_equipment.xml b/maintenance_location/views/maintenance_equipment.xml index bdf29e9c2..e1008b425 100644 --- a/maintenance_location/views/maintenance_equipment.xml +++ b/maintenance_location/views/maintenance_equipment.xml @@ -13,7 +13,7 @@ - + maintenance.equipment -
+
- - + + + &nbsp; +
-
+
diff --git a/maintenance_location/views/maintenance_location.xml b/maintenance_location/views/maintenance_location.xml index 7d2392bc9..a6768cd1b 100644 --- a/maintenance_location/views/maintenance_location.xml +++ b/maintenance_location/views/maintenance_location.xml @@ -54,16 +54,17 @@ maintenance.location.tree (in cb_maintenance) maintenance.location - + - + + maintenance-location Maintenance Location maintenance.location - tree,form + list,form [] {} diff --git a/maintenance_location/views/maintenance_request.xml b/maintenance_location/views/maintenance_request.xml index e6a849355..80b8aee17 100644 --- a/maintenance_location/views/maintenance_request.xml +++ b/maintenance_location/views/maintenance_request.xml @@ -44,7 +44,7 @@ Location :
+ >Location:
From 51ac32ab7d7a2b5dafe166c64cd78c6dff76ffee Mon Sep 17 00:00:00 2001 From: Yann Papouin Date: Mon, 20 Oct 2025 12:15:26 +0200 Subject: [PATCH 24/28] [IMP] maintenance_location: Add location on request report --- maintenance_location/__manifest__.py | 3 ++- .../views/report_maintenance_request.xml | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 maintenance_location/views/report_maintenance_request.xml diff --git a/maintenance_location/__manifest__.py b/maintenance_location/__manifest__.py index 0a081252c..9bd6b843d 100644 --- a/maintenance_location/__manifest__.py +++ b/maintenance_location/__manifest__.py @@ -11,10 +11,11 @@ "website": "https://github.com/OCA/maintenance", "depends": ["maintenance_plan"], "data": [ + "security/ir.model.access.csv", "views/maintenance_plan.xml", "views/maintenance_equipment.xml", - "security/ir.model.access.csv", "views/maintenance_request.xml", "views/maintenance_location.xml", + "views/report_maintenance_request.xml", ], } diff --git a/maintenance_location/views/report_maintenance_request.xml b/maintenance_location/views/report_maintenance_request.xml new file mode 100644 index 000000000..00eec4787 --- /dev/null +++ b/maintenance_location/views/report_maintenance_request.xml @@ -0,0 +1,16 @@ + + + + From ee8c80568677346a943a52540ca0988183457587 Mon Sep 17 00:00:00 2001 From: Yann Papouin Date: Mon, 20 Oct 2025 12:15:49 +0200 Subject: [PATCH 25/28] [IMP] maintenance_location: Demo data added --- maintenance_location/__manifest__.py | 5 +++ .../demo/demo_maintenance_equipment.xml | 15 ++++++++ .../demo/demo_maintenance_location.xml | 34 +++++++++++++++++++ .../demo/demo_maintenance_plan.xml | 33 ++++++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 maintenance_location/demo/demo_maintenance_equipment.xml create mode 100644 maintenance_location/demo/demo_maintenance_location.xml create mode 100644 maintenance_location/demo/demo_maintenance_plan.xml diff --git a/maintenance_location/__manifest__.py b/maintenance_location/__manifest__.py index 9bd6b843d..e5e0f616e 100644 --- a/maintenance_location/__manifest__.py +++ b/maintenance_location/__manifest__.py @@ -18,4 +18,9 @@ "views/maintenance_location.xml", "views/report_maintenance_request.xml", ], + "demo": [ + "demo/demo_maintenance_location.xml", + "demo/demo_maintenance_plan.xml", + "demo/demo_maintenance_equipment.xml", + ], } diff --git a/maintenance_location/demo/demo_maintenance_equipment.xml b/maintenance_location/demo/demo_maintenance_equipment.xml new file mode 100644 index 000000000..86f72929e --- /dev/null +++ b/maintenance_location/demo/demo_maintenance_equipment.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/maintenance_location/demo/demo_maintenance_location.xml b/maintenance_location/demo/demo_maintenance_location.xml new file mode 100644 index 000000000..50f84e1ac --- /dev/null +++ b/maintenance_location/demo/demo_maintenance_location.xml @@ -0,0 +1,34 @@ + + + + Building A + Main office building + + + + Level 1 + + + + + Level 2 + + + + + Building B + Secondary building + + + + Warehouse + Storage and logistics area + + + + + Workshop + Maintenance and repair workshop + + + diff --git a/maintenance_location/demo/demo_maintenance_plan.xml b/maintenance_location/demo/demo_maintenance_plan.xml new file mode 100644 index 000000000..74a92c369 --- /dev/null +++ b/maintenance_location/demo/demo_maintenance_plan.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + From 99ea32940bcfcce8b5f672b11f50bc911eb3f7c5 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Fri, 10 Jul 2026 10:04:56 +0000 Subject: [PATCH 26/28] [UPD] Update maintenance_location.pot --- .../i18n/maintenance_location.pot | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/maintenance_location/i18n/maintenance_location.pot b/maintenance_location/i18n/maintenance_location.pot index 7d6107b61..fc5830d27 100644 --- a/maintenance_location/i18n/maintenance_location.pot +++ b/maintenance_location/i18n/maintenance_location.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 17.0\n" +"Project-Id-Version: Odoo Server 18.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -13,6 +13,11 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: maintenance_location +#: model_terms:ir.ui.view,arch_db:maintenance_location.hr_equipment_view_kanban +msgid "&nbsp;" +msgstr "" + #. module: maintenance_location #: model_terms:ir.ui.view,arch_db:maintenance_location.maintenance_location_form_view msgid "" @@ -25,6 +30,11 @@ msgstr "" msgid "" msgstr "" +#. module: maintenance_location +#: model_terms:ir.ui.view,arch_db:maintenance_location.report_maintenance_request_document +msgid "Location:" +msgstr "" + #. module: maintenance_location #: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__active msgid "Active" @@ -80,7 +90,6 @@ msgstr "" #. module: maintenance_location #. odoo-python #: code:addons/maintenance_location/models/maintenance_location.py:0 -#, python-format msgid "Error ! You cannot create recursive Locations." msgstr "" @@ -117,11 +126,6 @@ msgstr "" msgid "Location" msgstr "" -#. module: maintenance_location -#: model_terms:ir.ui.view,arch_db:maintenance_location.hr_equipment_request_view_kanban -msgid "Location :" -msgstr "" - #. module: maintenance_location #: model:ir.model.fields,field_description:maintenance_location.field_maintenance_equipment__location msgid "Location Old" @@ -132,6 +136,11 @@ msgstr "" msgid "Location name" msgstr "" +#. module: maintenance_location +#: model_terms:ir.ui.view,arch_db:maintenance_location.hr_equipment_request_view_kanban +msgid "Location:" +msgstr "" + #. module: maintenance_location #: model:ir.model.fields,field_description:maintenance_location.field_maintenance_location__longitude msgid "Longitude" From 6520a3c5fc282ca6e24717b9fbf8d4d8a12593fc Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 10 Jul 2026 10:09:08 +0000 Subject: [PATCH 27/28] [BOT] post-merge updates --- maintenance_location/README.rst | 8 ++++-- .../static/description/index.html | 26 ++++++++++++------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/maintenance_location/README.rst b/maintenance_location/README.rst index b208bc0ab..4776023ab 100644 --- a/maintenance_location/README.rst +++ b/maintenance_location/README.rst @@ -1,3 +1,7 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + ==================== Maintenance Location ==================== @@ -7,13 +11,13 @@ Maintenance Location !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:8c8c6f926ab0925c0f8407dba57714d9a272dd8e3cc66f0a777ac466d84d69e5 + !! source digest: sha256:3ff7ac30f0fda6039a545738af35ee21d3baebbb675e981b9a417e4133af777d !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |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 +.. |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-OCA%2Fmaintenance-lightgray.png?logo=github diff --git a/maintenance_location/static/description/index.html b/maintenance_location/static/description/index.html index 2d4f525cd..230fc670b 100644 --- a/maintenance_location/static/description/index.html +++ b/maintenance_location/static/description/index.html @@ -3,7 +3,7 @@ -Maintenance Location +README.rst -
-

Maintenance Location

+
+ + +Odoo Community Association + +
+

Maintenance Location

-

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

+

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

Define a location system with hierarchy for maintenance equipments and requests.

Table of contents

@@ -385,7 +390,7 @@

Maintenance Location

-

Bug Tracker

+

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 @@ -393,16 +398,16 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • CreuBlanca
  • Dixmit
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -433,5 +438,6 @@

Maintainers

+
From 37b62c9e3c948317e9f31b94cd082b66271bcf3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Rivi=C3=A8re?= Date: Tue, 28 Jul 2026 12:23:31 +0200 Subject: [PATCH 28/28] [MIG] maintenance_location: Migration to 19.0 --- maintenance_location/README.rst | 24 +++++++++---------- maintenance_location/__manifest__.py | 2 +- .../models/maintenance_location.py | 6 ++--- .../static/description/index.html | 6 ++--- .../views/maintenance_equipment.xml | 3 --- 5 files changed, 19 insertions(+), 22 deletions(-) diff --git a/maintenance_location/README.rst b/maintenance_location/README.rst index 4776023ab..17691ae3a 100644 --- a/maintenance_location/README.rst +++ b/maintenance_location/README.rst @@ -21,13 +21,13 @@ Maintenance Location :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 + :target: https://github.com/OCA/maintenance/tree/19.0/maintenance_location :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 + :target: https://translation.odoo-community.org/projects/maintenance-19-0/maintenance-19-0-maintenance_location :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 + :target: https://runboat.odoo-community.org/builds?repo=OCA/maintenance&target_branch=19.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -46,7 +46,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -62,18 +62,18 @@ Authors Contributors ------------ -- `Dixmit `__ +- `Dixmit `__ - - Enric Tobella + - Enric Tobella -- CreuBlanca +- CreuBlanca - - Kevin Luna - - Jaime Arroyo + - Kevin Luna + - Jaime Arroyo -- `Heliconia Solutions Pvt. Ltd. `__ +- `Heliconia Solutions Pvt. Ltd. `__ - - Bhavesh Heliconia + - Bhavesh Heliconia Maintainers ----------- @@ -88,6 +88,6 @@ 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. +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/__manifest__.py b/maintenance_location/__manifest__.py index e5e0f616e..9cfd2a32a 100644 --- a/maintenance_location/__manifest__.py +++ b/maintenance_location/__manifest__.py @@ -5,7 +5,7 @@ "name": "Maintenance Location", "summary": """ Define a location system for maintenance""", - "version": "18.0.1.0.0", + "version": "19.0.1.0.0", "license": "AGPL-3", "author": "CreuBlanca, Dixmit,Odoo Community Association (OCA)", "website": "https://github.com/OCA/maintenance", diff --git a/maintenance_location/models/maintenance_location.py b/maintenance_location/models/maintenance_location.py index 76671a0a7..d7f8d462d 100644 --- a/maintenance_location/models/maintenance_location.py +++ b/maintenance_location/models/maintenance_location.py @@ -65,12 +65,12 @@ def _compute_equipment_count(self): all_locations = self.env["maintenance.location"].search( [("id", "child_of", self.ids)] ) - equip_data = self.env["maintenance.equipment"].read_group( + equip_data = self.env["maintenance.equipment"]._read_group( domain=[("location_id", "in", all_locations.ids)], - fields=["location_id"], groupby=["location_id"], + aggregates=["__count"], ) - count_dict = {x["location_id"][0]: x["location_id_count"] for x in equip_data} + count_dict = {location.id: count for location, count in equip_data} for location in self: descendant_ids = all_locations.filtered( lambda sub_loc, loc=location: sub_loc.parent_path diff --git a/maintenance_location/static/description/index.html b/maintenance_location/static/description/index.html index 230fc670b..3e80928bb 100644 --- a/maintenance_location/static/description/index.html +++ b/maintenance_location/static/description/index.html @@ -374,7 +374,7 @@

Maintenance Location

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:3ff7ac30f0fda6039a545738af35ee21d3baebbb675e981b9a417e4133af777d !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

Define a location system with hierarchy for maintenance equipments and requests.

Table of contents

@@ -394,7 +394,7 @@

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.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -433,7 +433,7 @@

Maintainers

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.

+

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/views/maintenance_equipment.xml b/maintenance_location/views/maintenance_equipment.xml index e1008b425..c170dffee 100644 --- a/maintenance_location/views/maintenance_equipment.xml +++ b/maintenance_location/views/maintenance_equipment.xml @@ -7,9 +7,6 @@ maintenance.equipment - - 1 -