diff options
| author | alt-odoo <alt@odoo.com> | 2020-11-20 13:12:56 +0000 |
|---|---|---|
| committer | alt-odoo <alt@odoo.com> | 2020-11-23 16:21:37 +0000 |
| commit | fb16040f55b5900f39943fb873ef5db43f94f24f (patch) | |
| tree | 5225b3f3efbce415c3a40ab5e1d216b4f8fa5f11 /addons/base_import | |
| parent | f05d3f5f44b6e70b8b8e66b64a55d5f5b1577d1c (diff) | |
[FIX] base_import: allow import of dates in German format
The German date format is the following: DD.MM.YYYY but when importing
such value, it is wrongly considered as a float value due to the '.'
being confused with the thousands separator in the regexp of method
_remove_currency_symbol.
We should check both date/time and float/monetary formats, so it will
correctly identify the German date format as well as float values.
closes odoo/odoo#62202
X-original-commit: 1bdd0cc247d36c869ffdee7d501cb65d36be47a6
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Alex Tuyls <alt-odoo@users.noreply.github.com>
Diffstat (limited to 'addons/base_import')
| -rw-r--r-- | addons/base_import/models/base_import.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/base_import/models/base_import.py b/addons/base_import/models/base_import.py index 266280ff77a..733c3060a97 100644 --- a/addons/base_import/models/base_import.py +++ b/addons/base_import/models/base_import.py @@ -400,6 +400,7 @@ class Import(models.TransientModel): return ['boolean'] # If all values can be cast to float, type is either float or monetary + results = [] try: thousand_separator = decimal_separator = False for val in preview_values: @@ -432,11 +433,11 @@ class Import(models.TransientModel): if thousand_separator and not options.get('float_decimal_separator'): options['float_thousand_separator'] = thousand_separator options['float_decimal_separator'] = decimal_separator - return ['float', 'monetary'] + results = ['float', 'monetary'] except ValueError: pass - results = self._try_match_date_time(preview_values, options) + results += self._try_match_date_time(preview_values, options) if results: return results |
