From 94f513dce79e294c32eb9969e969b0e2955f3fd3 Mon Sep 17 00:00:00 2001 From: Jose Zambudio Bernabeu Date: Sat, 18 Nov 2017 19:51:47 +0100 Subject: [PATCH] [FIX] quality_control: Fix TypeError on new test category (#193) `TestQualityControl` is failing on `QcTestTemplateCatergory._get_complete_name` when `name` is set as `False`. --- quality_control/models/qc_test_category.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/quality_control/models/qc_test_category.py b/quality_control/models/qc_test_category.py index 061d4b93d6a..cec3228e03b 100644 --- a/quality_control/models/qc_test_category.py +++ b/quality_control/models/qc_test_category.py @@ -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):