Skip to content

Commit

Permalink
[ADD] Test sequence prefix inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
rf-ife committed Nov 29, 2024
1 parent 6b65c3a commit 50ff75f
Showing 1 changed file with 24 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,6 @@ def test_01_maintenance_equipment_sequence(self):
sequence number has been set
"""
# Create category
seq_0 = self.sequence_obj.create(
{
"name": "Test Sequence",
"implementation": "no_gap",
"prefix": "TTC_TEST",
"padding": 4,
"number_increment": 1,
"use_date_range": False,
}
)
categ_0 = self.maintenance_equipment_categ_obj.create(
{
"name": "Test Category 0",
"sequence_id": seq_0.id,
}
)
self.assertEqual(categ_0.sequence_prefix, seq_0.prefix)

categ_1 = self.maintenance_equipment_categ_obj.create(
{
Expand Down Expand Up @@ -77,3 +60,27 @@ def test_01_maintenance_equipment_sequence(self):
# Remove code and be automatically set to sequence next value
equipment_1.write({"serial_no": False})
self.assertEqual(equipment_1.serial_no, "TTC0002")

def test_02_maintenance_equipment_sequence(self):
"""Create an equipment category linked to a default sequence with a prefix,
and verify that the category correctly inherits the sequence prefix.
"""
# Create a sequence
seq_1 = self.sequence_obj.create(
{
"name": "Test Sequence",
"implementation": "no_gap",
"prefix": "TTC_TEST",
"padding": 4,
"number_increment": 1,
"use_date_range": False,
}
)
# Create an equipment category linked to the sequence
categ_1 = self.maintenance_equipment_categ_obj.create(
{
"name": "Test Category 0",
"sequence_id": seq_1.id,
}
)
self.assertEqual(categ_1.sequence_prefix, seq_1.prefix)

0 comments on commit 50ff75f

Please sign in to comment.