[FIX] base_import: import with user date parsing pattern

Before this commit, when a user imports an Excel file, with date as
strings. The _try_match_date_time function will try to find the best
date parsing to use in the import without taking into account the
language of the user.

Now, the function will take into account the language of the user when
trying to find the best date parsing pattern for the import.

opw-2046217

closes odoo/odoo#35540

Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
This commit is contained in:
Jorge Pinna Puissant
2019-08-08 06:22:18 +00:00
parent 3f634f29bd
commit 32c2666d18
+3
View File
@@ -444,6 +444,9 @@ class Import(models.TransientModel):
# Or a date/datetime if it matches the pattern
date_patterns = [options['date_format']] if options.get(
'date_format') else []
user_date_format = self.env['res.lang']._lang_get(self.env.user.lang).date_format
if user_date_format:
date_patterns.append(user_date_format)
date_patterns.extend(DATE_PATTERNS)
match = check_patterns(date_patterns, preview_values)
if match: