diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-01-09 15:44:05 +0000 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-01-09 15:56:53 +0000 |
| commit | 8aa8548d8ab68feb13f3bde51c557db84877e809 (patch) | |
| tree | 930790c1c84a4412db777986f6b2077808560d95 /odoo/addons/test_impex | |
| parent | 55a48e341580a6a400c36b6ba0d7b12ff9997f12 (diff) | |
| parent | 3e4138deaa23b3631dc3fce33cd6d1b3be28ffbd (diff) | |
[MERGE] forward port branch 12.0 up to 3e4138deaa2
closes odoo/odoo#30045
Diffstat (limited to 'odoo/addons/test_impex')
| -rw-r--r-- | odoo/addons/test_impex/tests/test_export.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/odoo/addons/test_impex/tests/test_export.py b/odoo/addons/test_impex/tests/test_export.py index 058d7581bf2..264db66e992 100644 --- a/odoo/addons/test_impex/tests/test_export.py +++ b/odoo/addons/test_impex/tests/test_export.py @@ -19,11 +19,11 @@ class CreatorCase(common.TransactionCase): super(CreatorCase, self).setUp() self.model = self.env[self.model_name] - def make(self, value): - return self.model.create({'value': value}) + def make(self, value, context=None): + return self.model.with_context(**(context or {})).create({'value': value}) def export(self, value, fields=('value',), context=None): - record = self.make(value) + record = self.make(value, context=context) record.invalidate_cache() return record._export_rows([f.split('/') for f in fields]) @@ -242,19 +242,21 @@ class test_datetime(CreatorCase): [['']]) def test_basic(self): + """ Export value with no TZ set on the user + """ + self.env.user.write({'tz': False}) self.assertEqual( self.export('2011-11-07 21:05:48'), [[u'2011-11-07 21:05:48']]) def test_tz(self): - """ Export ignores the timezone and always exports to UTC + """ Export converts the value in the user's TZ .. note:: on the other hand, export uses user lang for name_get """ - # NOTE: ignores user timezone, always exports to UTC self.assertEqual( self.export('2011-11-07 21:05:48', context={'tz': 'Pacific/Norfolk'}), - [[u'2011-11-07 21:05:48']]) + [[u'2011-11-08 08:35:48']]) class test_selection(CreatorCase): @@ -290,7 +292,7 @@ class test_selection(CreatorCase): }) self.assertEqual( self.export(2, context={'lang': 'fr_FR'}), - [[u'Bar']]) + [[u'titi']]) class test_selection_function(CreatorCase): |
