[FIX] base_import: when parsing date field, strip extra spaces

This commit is contained in:
Cedric Snauwaert
2017-07-12 13:48:22 +02:00
parent e6e17cc5d6
commit 999dc80e7c
+1 -1
View File
@@ -615,7 +615,7 @@ class Import(models.TransientModel):
for num, line in enumerate(data):
if line[index]:
try:
line[index] = dt.strftime(dt.strptime(ustr(line[index]).encode('utf-8'), user_format), server_format)
line[index] = dt.strftime(dt.strptime(ustr(line[index].strip()).encode('utf-8'), user_format), server_format)
except ValueError, e:
raise ValueError(_("Column %s contains incorrect values. Error in line %d: %s") % (name, num + 1, ustr(e.message)))
except Exception, e: