From 9c2407b9ec7b5c825d57218cedc8a3317fc2a435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Thu, 19 Dec 2024 16:48:20 +0100 Subject: [PATCH] [MIG] maintenance_equipment_usage: Migration to 17.0 TT52302 --- maintenance_equipment_usage/__manifest__.py | 2 +- .../models/maintenance_equipment_usage.py | 18 --------- .../tests/test_maintenance_equipment_usage.py | 16 ++++---- .../maintenance_equipment_usage_views.xml | 40 ++++++++++++++----- .../views/maintenance_equipment_view.xml | 4 +- 5 files changed, 40 insertions(+), 40 deletions(-) diff --git a/maintenance_equipment_usage/__manifest__.py b/maintenance_equipment_usage/__manifest__.py index acff6f5bb..1d33bf7a7 100644 --- a/maintenance_equipment_usage/__manifest__.py +++ b/maintenance_equipment_usage/__manifest__.py @@ -3,7 +3,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Maintenance Equipment Usage", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "category": "Maintenance", "website": "https://github.com/OCA/maintenance", "author": "César Fernández, Tecnativa, Odoo Community Association (OCA)", diff --git a/maintenance_equipment_usage/models/maintenance_equipment_usage.py b/maintenance_equipment_usage/models/maintenance_equipment_usage.py index 0711ae2b0..24c10678f 100644 --- a/maintenance_equipment_usage/models/maintenance_equipment_usage.py +++ b/maintenance_equipment_usage/models/maintenance_equipment_usage.py @@ -18,55 +18,39 @@ class MaintenanceEquipmentUsage(models.Model): comodel_name="res.users", string="User", required=True, - readonly=True, - states={"draft": [("readonly", False)], "reserved": [("readonly", False)]}, tracking=True, ) picking_user_id = fields.Many2one( comodel_name="res.users", string="Picked up by", - readonly=True, - states={"draft": [("readonly", False)], "reserved": [("readonly", False)]}, tracking=True, ) return_user_id = fields.Many2one( comodel_name="res.users", string="Returned by", - states={ - "in_use": [("required", True)], - "returned": [("readonly", True)], - "cancel": [("readonly", True)], - }, tracking=True, ) date_picking = fields.Datetime( string="Picking Date", copy=False, index=True, - readonly=True, - states={"draft": [("readonly", False)], "reserved": [("readonly", False)]}, tracking=True, ) date_return = fields.Datetime( string="Return Date", copy=False, index=True, - states={"returned": [("readonly", True)], "cancel": [("readonly", True)]}, tracking=True, ) equipment_id = fields.Many2one( comodel_name="maintenance.equipment", string="Equipment", required=True, - readonly=True, - states={"draft": [("readonly", False)], "reserved": [("readonly", False)]}, tracking=True, ) partner_id = fields.Many2one( comodel_name="res.partner", string="Location", - readonly=True, - states={"draft": [("readonly", False)], "reserved": [("readonly", False)]}, tracking=True, ) state = fields.Selection( @@ -88,8 +72,6 @@ class MaintenanceEquipmentUsage(models.Model): required=True, index=True, default=lambda self: self.env.company.id, - readonly=True, - states={"draft": [("readonly", False)], "reserved": [("readonly", False)]}, tracking=True, ) notes = fields.Text() diff --git a/maintenance_equipment_usage/tests/test_maintenance_equipment_usage.py b/maintenance_equipment_usage/tests/test_maintenance_equipment_usage.py index e102886ff..575893878 100644 --- a/maintenance_equipment_usage/tests/test_maintenance_equipment_usage.py +++ b/maintenance_equipment_usage/tests/test_maintenance_equipment_usage.py @@ -11,19 +11,17 @@ class TestMaintenanceEquipmentUsage(BaseCommon): @classmethod def setUpClass(cls): super().setUpClass() - cls.user = new_test_user( - cls.env, - login="test_basic_user", - ) + cls.user = new_test_user(cls.env, login="test_basic_user") cls.equipment = cls.env["maintenance.equipment"].create( {"name": "Test equipment"} ) - cls.equipment_usage = cls._create_equipment_usage(cls) + cls.equipment_usage = cls._create_equipment_usage() - def _create_equipment_usage(self): - equipment_usage_form = Form(self.env["maintenance.equipment.usage"]) - equipment_usage_form.equipment_id = self.equipment - equipment_usage_form.user_id = self.user + @classmethod + def _create_equipment_usage(cls): + equipment_usage_form = Form(cls.env["maintenance.equipment.usage"]) + equipment_usage_form.equipment_id = cls.equipment + equipment_usage_form.user_id = cls.user return equipment_usage_form.save() def test_maintenance_equipment_full_process(self): diff --git a/maintenance_equipment_usage/views/maintenance_equipment_usage_views.xml b/maintenance_equipment_usage/views/maintenance_equipment_usage_views.xml index 432002190..03a2d3212 100644 --- a/maintenance_equipment_usage/views/maintenance_equipment_usage_views.xml +++ b/maintenance_equipment_usage/views/maintenance_equipment_usage_views.xml @@ -23,21 +23,21 @@