diff --git a/odoo/addons/test_impex/tests/test_export.py b/odoo/addons/test_impex/tests/test_export.py index 1239436839c..95edb7cd805 100644 --- a/odoo/addons/test_impex/tests/test_export.py +++ b/odoo/addons/test_impex/tests/test_export.py @@ -243,19 +243,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): diff --git a/odoo/fields.py b/odoo/fields.py index a678dec06d5..8ecbd81fda0 100644 --- a/odoo/fields.py +++ b/odoo/fields.py @@ -1726,6 +1726,7 @@ class Datetime(Field): def convert_to_export(self, value, record): if not value: return '' + value = self.convert_to_display_name(value, record) return self.from_string(value) if record._context.get('export_raw_data') else ustr(value) def convert_to_display_name(self, value, record):