[FIX] tools: don't extract missing spreadsheet data source name

Previous versions of spreadsheet files don't have a name
for list and pivot datasources.

The spreadsheet template "pipeline dashboard" in `document_spreadsheet_crm`
is such a file.
As a consequence, exporting the source terms from this module fails
with a `KeyError: 'name'`

Part-of: odoo/odoo#101659
This commit is contained in:
Lucas Lefèvre
2022-09-30 09:31:52 +02:00
committed by Martin Trigaux
parent e1af8cd69c
commit f07cd645c9
+2 -1
View File
@@ -942,7 +942,8 @@ def extract_spreadsheet_terms(fileobj, keywords, comment_tags, options):
pivots = data.get('pivots', {}).values()
lists = data.get('lists', {}).values()
for data_source in itertools.chain(lists, pivots):
terms.append(data_source['name'])
if 'name' in data_source:
terms.append(data_source['name'])
for global_filter in data.get('globalFilters', []):
terms.append(global_filter['label'])
return (