Skip to content

Commit

Permalink
[FIX] quality_control: Fix TypeError on new test category (OCA#193)
Browse files Browse the repository at this point in the history
`TestQualityControl` is failing on `QcTestTemplateCatergory._get_complete_name`
when `name` is set as `False`.
  • Loading branch information
zamberjo authored and pedrobaeza committed Feb 13, 2021
1 parent 714f6fe commit b6f4281
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions quality_control_oca/models/qc_test_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ class QcTestTemplateCategory(models.Model):
_name = 'qc.test.category'
_description = 'Test category'

@api.one
@api.multi
@api.depends('name', 'parent_id')
def _get_complete_name(self):
names = [self.name]
parent = self.parent_id
while parent:
names.append(parent.name)
parent = parent.parent_id
self.complete_name = " / ".join(reversed(names))
for record in self:
names = [record.name or '']
parent = record.parent_id
while parent:
names.append(parent.name)
parent = parent.parent_id
record.complete_name = " / ".join(reversed(names))

@api.constrains('parent_id')
def _check_recursion(self):
Expand Down

0 comments on commit b6f4281

Please sign in to comment.