Skip to content

Commit 0b12ca8

Browse files
committed
Merge PR #2067 into 18.0
Signed-off-by pedrobaeza
2 parents 6c7cbf4 + 27762ba commit 0b12ca8

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

partner_industry_secondary/tests/test_res_partner_industry.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ def setUpClass(cls):
2727
cls.partner = cls.env["res.partner"].create({"name": "Test partner"})
2828

2929
def test_00_check_industries(self):
30+
"""Verifies that a partner cannot have the same industry set as both
31+
main and secondary."""
3032
with self.assertRaises(ValidationError):
3133
self.env["res.partner"].create(
3234
{
@@ -37,21 +39,29 @@ def test_00_check_industries(self):
3739
)
3840

3941
def test_01_check_copy(self):
42+
"""Verifies that when duplicating an industry,
43+
a new name is automatically assigned."""
4044
industry_copy = self.industry_child.copy()
4145
self.assertEqual(industry_copy.name, "Test child 2")
4246

4347
def test_02_check_uniq_name(self):
48+
"""Ensures that two industries with the same name
49+
and parent cannot be created."""
4450
with self.assertRaises(ValidationError):
4551
self.industry_model.create({"name": "Test"})
4652

4753
def test_03_check_recursion(self):
48-
with self.assertRaises(UserError):
54+
"""Checks that a recursive hierarchy among industries is not allowed."""
55+
with self.assertRaisesRegex(UserError, "Recursion Detected."):
4956
self.industry_main.parent_id = self.industry_child.id
5057

5158
def test_04_name(self):
59+
"""Verifies that the 'display_name' field correctly shows the hierarchy."""
5260
self.assertEqual(self.industry_child.display_name, "Test / Test child")
5361

5462
def test_05_check_partner_industries(self):
63+
"""Verifies that a partner cannot have the same industry set as both main
64+
and secondary."""
5565
main = self.industry_main
5666
both = self.industry_main | self.industry_child
5767
with self.assertRaises(ValidationError):
@@ -60,5 +70,7 @@ def test_05_check_partner_industries(self):
6070
)
6171

6272
def test_06_check_show_partner_industry_for_person(self):
73+
"""Verifies that the system correctly computes whether to show industries
74+
for individuals, based on user group."""
6375
self.partner._compute_show_partner_industry_for_person()
6476
self.assertEqual(self.partner.show_partner_industry_for_person, True)

0 commit comments

Comments
 (0)