[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:
Nicolas Martinelli
2017-09-05 16:37:48 +02:00
parent 80ca45b161
commit a4bcb66bfc
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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, {
+1 -1
View File
@@ -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):