-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] fleet_vehicle_calendar_year: Migration to 18.0
- Loading branch information
1 parent
4a2ffb5
commit bf26239
Showing
6 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
- Marcel Savegnago \<<marcel.savegnago@escodoo.com.br>\> | ||
- Kaynnan Lemes \<<kaynnan.lemes@escodoo.com.br>\> | ||
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import fleet_vehicle_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from odoo.tests.common import TransactionCase | ||
|
||
|
||
class TestFleetVehicle(TransactionCase): | ||
def setUp(self): | ||
super().setUp() | ||
self.FleetVehicle = self.env["fleet.vehicle"] | ||
self.vehicle = self.FleetVehicle.create( | ||
{ | ||
"name": "Test Vehicle", | ||
"license_plate": "TEST123", | ||
"model_id": self.env["fleet.vehicle.model"] | ||
.create({"name": "Test Model"}) | ||
.id, | ||
"calendar_year": "2024", | ||
} | ||
) | ||
|
||
def test_calendar_year_field(self): | ||
"""Test the calendar_year field functionality.""" | ||
# Check initial value | ||
self.assertEqual( | ||
self.vehicle.calendar_year, "2024", "Calendar year should be '2024'" | ||
) | ||
|
||
# Update calendar_year | ||
self.vehicle.calendar_year = "2025" | ||
self.assertEqual( | ||
self.vehicle.calendar_year, | ||
"2025", | ||
"Calendar year should be updated to '2025'", | ||
) | ||
|
||
def test_tracking(self): | ||
"""Test if changes in the calendar_year field are tracked in the chatter.""" | ||
message_count_before = len(self.vehicle.message_ids) | ||
|
||
# Modify the calendar_year | ||
self.vehicle.calendar_year = "2026" | ||
|
||
message_count_after = len(self.vehicle.message_ids) | ||
self.assertGreater( | ||
message_count_after, | ||
message_count_before, | ||
"The calendar_year change should create a new message in the chatter", | ||
) |