Skip to content
Snippets Groups Projects
Commit 32c2666d authored by Jorge Pinna Puissant's avatar Jorge Pinna Puissant
Browse files

[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: default avatarJorge Pinna Puissant (jpp) <jpp@odoo.com>
parent 3f634f29
No related branches found
No related tags found
No related merge requests found
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment