|
@ -203,14 +203,19 @@ class XLSXImport(models.AbstractModel): |
|
|
'encoding': '', |
|
|
'encoding': '', |
|
|
'separator': '', |
|
|
'separator': '', |
|
|
'quoting': '"', |
|
|
'quoting': '"', |
|
|
'date_style': '', |
|
|
|
|
|
'datetime_style': '%Y-%m-%d %H:%M:%S', |
|
|
|
|
|
|
|
|
'date_format': '%Y-%m-%d', |
|
|
|
|
|
'datetime_format': '%Y-%m-%d %H:%M:%S', |
|
|
'float_thousand_separator': ',', |
|
|
'float_thousand_separator': ',', |
|
|
'float_decimal_separator': '.', |
|
|
'float_decimal_separator': '.', |
|
|
'fields': []}) |
|
|
'fields': []}) |
|
|
if errors.get('messages'): |
|
|
if errors.get('messages'): |
|
|
message = errors['messages']['message'].encode('utf-8') |
|
|
|
|
|
raise ValidationError(message) |
|
|
|
|
|
|
|
|
message = _('Error importing data') |
|
|
|
|
|
messages = errors['messages'] |
|
|
|
|
|
if isinstance(messages, dict): |
|
|
|
|
|
message = messages['message'] |
|
|
|
|
|
if isinstance(messages, list): |
|
|
|
|
|
message = ', '.join([x['message'] for x in messages]) |
|
|
|
|
|
raise ValidationError(message.encode('utf-8')) |
|
|
return self.env.ref(xml_id) |
|
|
return self.env.ref(xml_id) |
|
|
except xlrd.XLRDError: |
|
|
except xlrd.XLRDError: |
|
|
raise ValidationError( |
|
|
raise ValidationError( |
|
|