diff options
| author | Jeremy Kersten <jke@odoo.com> | 2016-10-13 16:28:49 +0200 |
|---|---|---|
| committer | Jeremy Kersten <jke@odoo.com> | 2016-10-14 12:36:04 +0200 |
| commit | 7a7723eacfe395f174a42ba615392e2183130126 (patch) | |
| tree | ee90dc05cbc445988e30b4e300bd85acb4aa8271 /addons/base_import/tests | |
| parent | 8153e60653d638ed6fa7dcceaaf1974e6176a3ab (diff) | |
[FIX] base_import: allow to specify datetime format, fix encoding, add test date, fix translation
After this commit,
- chinese custom date are supported
- Possibility to specify the custom datetime format and not only dateformat.
Withtout it, impossible to import a date column and datetime column at
sametime with custom format.
- Add test to check import date with custom format
- Fix translation where error messages was in the source.
This commit fixes #13783 and closes #13803
Courtesy of @odony for the review ;)
Diffstat (limited to 'addons/base_import/tests')
| -rw-r--r-- | addons/base_import/tests/test_base_import.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/addons/base_import/tests/test_base_import.py b/addons/base_import/tests/test_base_import.py index 9fcadd27e5a..68a562971c4 100644 --- a/addons/base_import/tests/test_base_import.py +++ b/addons/base_import/tests/test_base_import.py @@ -379,6 +379,31 @@ class test_convert_import_data(TransactionCase): ['qux', '5', '6'], ]) + def test_date_fields(self): + import_wizard = self.env['base_import.import'].create({ + 'res_model': 'res.partner', + 'file': 'name,date,create_date\n' + '"foo","2013年07月18日","2016-10-12 06:06"\n', + 'file_type': 'text/csv' + + }) + + results = import_wizard.do( + ['name', 'date', 'create_date'], + { + 'date_format': '%Y年%m月%d日', + 'datetime_format': '%Y-%m-%d %H:%M', + 'quoting': '"', + 'separator': ',', + 'headers': True + } + ) + + # if results empty, no errors + self.assertItemsEqual(results, []) + + + def test_filtered(self): """ If ``False`` is provided as field mapping for a column, that column should be removed from importable data |
