diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2017-09-05 14:18:05 +0200 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2017-09-05 16:37:48 +0200 |
| commit | a4bcb66bfc9ebaf0582680bb7efa7ac541b76a5a (patch) | |
| tree | 9b624e64442aaebc4c61447fbecfe5f50667ee7b /addons | |
| parent | 80ca45b16119694203ea979bff4ba007984f4dd5 (diff) | |
[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
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/base_import/models/base_import.py | 2 | ||||
| -rw-r--r-- | addons/base_import/tests/test_base_import.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/addons/base_import/models/base_import.py b/addons/base_import/models/base_import.py index b9e22ad9925..552d62e978b 100644 --- a/addons/base_import/models/base_import.py +++ b/addons/base_import/models/base_import.py @@ -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, { diff --git a/addons/base_import/tests/test_base_import.py b/addons/base_import/tests/test_base_import.py index 6bef004936e..891fc3e7671 100644 --- a/addons/base_import/tests/test_base_import.py +++ b/addons/base_import/tests/test_base_import.py @@ -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): |
