diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2018-12-17 13:28:17 +0000 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2018-12-18 07:13:34 +0000 |
| commit | c819fc69ee0b8de9d0fe237d09b5e2f95206461d (patch) | |
| tree | f5ab3fff4b11f02610ce0bd493c72f720c43db19 /odoo/fields.py | |
| parent | dc9e87baa6930b4b628dcd4dbaf20e1f8b959c62 (diff) | |
[FIX] fields, test_impex: export Datetime
- Set a TZ on the user different from UTC
- Export a record containing a datetime, e.g. the Order Date of a SO
- Import the file
The Order Date is changed on the record.
The data export is always in UTC, but the data import takes into account
the user TZ, which explains the difference.
There is no good way of solving this in stable. We have 3 choices:
1. Do nothing: the flow export then import the same data is broken, as
explained above.
2. Export in the user TZ: if the file is imported in a third-party
software, we break the flow.
3. Import in UTC: if the file is generated from a third-party software,
we break the flow.
Whatever the choice is, we either break a flow or keep an inconsistent
behavior. We choose option 2, assuming that in most cases the user wants
to export the data in his TZ, therefore keeping the values displayed. We
only do it in v12 in order to mitigate the impact on existing
installations. A proper fix should be discussed for v13.
opw-1915631
closes odoo/odoo#29576
Diffstat (limited to 'odoo/fields.py')
| -rw-r--r-- | odoo/fields.py | 1 |
1 files changed, 1 insertions, 0 deletions
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): |
