diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-10-17 12:09:58 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-10-17 12:09:58 +0200 |
| commit | fbdda5437a8ecb575ffbcac7961aad44c9cf4ff8 (patch) | |
| tree | 239d86ce417811cb4a0d8cbc3b278c81131f22b5 /addons/base_import/tests | |
| parent | f4332118d3156e2ba2408c1d31ab92ee2066ef73 (diff) | |
| parent | cbca27d0052430743fe2c996964d7aca0ca682c9 (diff) | |
[MERGE] forward port branch 10.0 up to cbca27d0052
Diffstat (limited to 'addons/base_import/tests')
| -rw-r--r-- | addons/base_import/tests/test_base_import.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/addons/base_import/tests/test_base_import.py b/addons/base_import/tests/test_base_import.py index a0031c192e9..55e5c0538c3 100644 --- a/addons/base_import/tests/test_base_import.py +++ b/addons/base_import/tests/test_base_import.py @@ -402,7 +402,33 @@ class test_convert_import_data(TransactionCase): # if results empty, no errors self.assertItemsEqual(results, []) + def test_parse_relational_fields(self): + """ Ensure that relational fields float and date are correctly + parsed during the import call. + """ + import_wizard = self.env['base_import.import'].create({ + 'res_model': 'res.partner', + 'file': 'name,parent_id/id,parent_id/date,parent_id/credit_limit\n' + '"foo","__export__.res_partner_1","2017年10月12日","5,69"\n', + 'file_type': 'text/csv' + }) + options = { + 'date_format': '%Y年%m月%d日', + 'quoting': '"', + 'separator': ',', + 'float_decimal_separator': ',', + 'float_thousand_separator': '.', + 'headers': True + } + data, import_fields = import_wizard._convert_import_data( + ['name', 'parent_id/.id', 'parent_id/date', 'parent_id/credit_limit'], + options + ) + result = import_wizard._parse_import_data(data, import_fields, options) + # Check if the data 5,69 as been correctly parsed. + self.assertEqual(float(result[0][-1]), 5.69) + self.assertEqual(str(result[0][-2]), '2017-10-12') def test_filtered(self): """ If ``False`` is provided as field mapping for a column, |
