[FIX] base_import: headerless import
- Import a CSV file without header - Untick the option 'The first row contains the label of the column' An error is reported. If no header, the method `_match_headers` should return consistent object types. opw-769117
This commit is contained in:
@@ -453,7 +453,7 @@ class Import(models.TransientModel):
|
||||
:rtype: (None, None) | (list(str), dict(int: list(str)))
|
||||
"""
|
||||
if not options.get('headers'):
|
||||
return None, None
|
||||
return [], {}
|
||||
|
||||
headers = next(rows)
|
||||
return headers, {
|
||||
|
||||
@@ -152,7 +152,7 @@ class TestMatchHeadersMultiple(TransactionCase):
|
||||
|
||||
def test_noheaders(self):
|
||||
self.assertEqual(
|
||||
self.env['base_import.import']._match_headers([], [], {}), (None, None)
|
||||
self.env['base_import.import']._match_headers([], [], {}), ([], {})
|
||||
)
|
||||
|
||||
def test_nomatch(self):
|
||||
|
||||
Reference in New Issue
Block a user