[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:
Vijaykumar Baladaniya
2012-10-30 14:42:31 +05:30
parent b37dc17a3c
commit deaae5dec3
+11 -3
View File
@@ -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.