Skip to content

Commit

Permalink
[MIG] fieldservice_fleet: Migration to 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kaynnan committed Jul 10, 2023
1 parent 5cceecd commit e6f640c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fieldservice_fleet/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Field Service Fleet",
"summary": "Link Field Service vehicles with Odoo Fleet",
"version": "14.0.1.0.0",
"version": "15.0.1.0.0",
"category": "Field Service",
"author": "Brian McMaster, "
"Open Source Integrators, "
Expand Down
26 changes: 25 additions & 1 deletion fieldservice_fleet/tests/test_fsm_fleet_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ def test_convert_vehicle(self):
[("fleet_vehicle_id", "=", self.fleet_vehicle_1.id)]
)

# Create a driver partner without an associated fsm.person record
driver_partner = self.env["res.partner"].create(
{
"name": "Driver Partner",
}
)

# Retrieve the fsm_worker record for the driver partner
fsm_worker = self.env["fsm.person"].search(
[("partner_id", "=", driver_partner.id)]
)

self.assertEqual(
len(fsm_vehicle),
1,
Expand All @@ -47,6 +59,18 @@ def test_convert_vehicle(self):
"""FSM Fleet Wizard: FSM vehicle driver is not same
as the Fleet vehicle driver""",
)
self.assertTrue(
self.fleet_vehicle_1.driver_id and self.fleet_vehicle_1.is_fsm_vehicle,
"Driver ID and is_fsm_vehicle condition is not True",
)

# Set the driver_id of the fleet vehicle to the driver partner
self.fleet_vehicle_1.driver_id = driver_partner.id

# Assert that fsm_worker is not found
self.assertFalse(
fsm_worker, "FSM worker found for driver partner, but it should not exist"
)

# Attempt to convert the Fleet vehicle again, but expect UserError
# because we already converted it
Expand Down Expand Up @@ -97,4 +121,4 @@ def test_fsm_vehicle(self):
"active_ids": [self.fleet_vehicle_3.id],
"active_id": self.fleet_vehicle_3.id,
}
self.Wizard.with_context(self.context).action_convert()
self.Wizard.with_context(**self.context).action_convert()

0 comments on commit e6f640c

Please sign in to comment.