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 ps-tubtim committed Mar 16, 2020
1 parent 6655723 commit 559f414
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions quality_control/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 559f414

Please sign in to comment.