diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-10 10:39:45 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-10 10:39:45 +0700 |
| commit | f865594236cb4001df0ecd0838a2a9af417e106d (patch) | |
| tree | e7eb31a7b7735741b9603ff3417d0a59ba5adf3a | |
| parent | 26c0d5bef2a175764a6df6eac9a92d89f99d57d7 (diff) | |
| parent | 8d63c8fa2278182c02901a550103b5f670fe86c6 (diff) | |
Merge branch 'production' of bitbucket.org:altafixco/indoteknik-addons into production
| -rw-r--r-- | indoteknik_custom/models/solr/product_template.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index 029e0956..1d54cc9b 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -158,10 +158,14 @@ class ProductTemplate(models.Model): traverse_category(category.parent_id.id) # Start traversal from the initial category - traverse_category(category_id) - - # Reverse the list to get the hierarchy from top level to the current level - return list(reversed(category_ids)) + if category_id: # Check if category_id is not an empty value + traverse_category(category_id) + + # Reverse the list to get the hierarchy from top level to the current level + return list(reversed(category_ids)) + else: + # If category_id is empty, return an empty list + return [] def _sync_price_to_solr(self): solr_model = self.env['apache.solr'] |
