From 53bac5b0c13e0ea9badefee56e8c78b644337903 Mon Sep 17 00:00:00 2001 From: Enric Tobella Date: Sun, 26 Nov 2023 19:58:22 +0100 Subject: [PATCH] [FIX] fleet_vehicle_license_plate: Use the name search properly --- fleet_vehicle_license_plate_alt/models/fleet_vehicle.py | 3 +-- .../tests/test_vehicle_license_plate_alt.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/fleet_vehicle_license_plate_alt/models/fleet_vehicle.py b/fleet_vehicle_license_plate_alt/models/fleet_vehicle.py index 261e85a9..53d15643 100644 --- a/fleet_vehicle_license_plate_alt/models/fleet_vehicle.py +++ b/fleet_vehicle_license_plate_alt/models/fleet_vehicle.py @@ -29,7 +29,6 @@ def _name_search( ("driver_id.name", operator, name), ("license_plate_alt", operator, name), ] - rec = self._search( + return self._search( expression.AND([domain, args]), limit=limit, access_rights_uid=name_get_uid ) - return models.lazy_name_get(self.browse(rec).with_user(name_get_uid)) diff --git a/fleet_vehicle_license_plate_alt/tests/test_vehicle_license_plate_alt.py b/fleet_vehicle_license_plate_alt/tests/test_vehicle_license_plate_alt.py index 9f03fd95..dcfaf55b 100644 --- a/fleet_vehicle_license_plate_alt/tests/test_vehicle_license_plate_alt.py +++ b/fleet_vehicle_license_plate_alt/tests/test_vehicle_license_plate_alt.py @@ -23,5 +23,5 @@ def setUp(self): def test_search_vehicle_by_license_plate_alt(self): """Check correct searching of vehicles by license_plate_alt.""" - vehicle_search = self.env["fleet.vehicle"]._name_search("1-ACK-556") + vehicle_search = self.env["fleet.vehicle"].name_search("1-ACK-556") self.assertEqual(vehicle_search[0][1], self.vehicle.display_name)