Skip to content

Commit c3f8d94

Browse files
zamberjoLoisRForgeFlow
authored andcommitted
[FIX] quality_control: Fix TypeError on new test category (OCA#193)
`TestQualityControl` is failing on `QcTestTemplateCatergory._get_complete_name` when `name` is set as `False`.
1 parent e12fbd6 commit c3f8d94

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

quality_control/models/qc_test_category.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ class QcTestTemplateCategory(models.Model):
1212
_name = 'qc.test.category'
1313
_description = 'Test category'
1414

15-
@api.one
15+
@api.multi
1616
@api.depends('name', 'parent_id')
1717
def _get_complete_name(self):
18-
names = [self.name]
19-
parent = self.parent_id
20-
while parent:
21-
names.append(parent.name)
22-
parent = parent.parent_id
23-
self.complete_name = " / ".join(reversed(names))
18+
for record in self:
19+
names = [record.name or '']
20+
parent = record.parent_id
21+
while parent:
22+
names.append(parent.name)
23+
parent = parent.parent_id
24+
record.complete_name = " / ".join(reversed(names))
2425

2526
@api.constrains('parent_id')
2627
def _check_recursion(self):

0 commit comments

Comments
 (0)