[IMP]Give a proper message When a validate or import is refused due to a problem.
bzr revid: vba@tinyerp.com-20121030091231-ty2edtpcjyaxqzzx
This commit is contained in:
@@ -316,9 +316,17 @@ class ir_import(orm.TransientModel):
|
||||
}]
|
||||
|
||||
_logger.info('importing %d rows...', len(data))
|
||||
import_result = self.pool[record.res_model].load(
|
||||
cr, uid, import_fields, data, context=context)
|
||||
_logger.info('done')
|
||||
try:
|
||||
import_result = self.pool[record.res_model].load(
|
||||
cr, uid, import_fields, data, context=context)
|
||||
_logger.info('done')
|
||||
except Exception, e:
|
||||
_logger.info(e)
|
||||
return [{
|
||||
'type': 'error',
|
||||
'message': unicode('No data have been imported.'),
|
||||
'record': False,
|
||||
}]
|
||||
|
||||
# If transaction aborted, RELEASE SAVEPOINT is going to raise
|
||||
# an InternalError (ROLLBACK should work, maybe). Ignore that.
|
||||
|
||||
Reference in New Issue
Block a user