From 0219368ce794652f67c43b73b1f43bcb367b7998 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 24 Aug 2010 18:05:15 +0200 Subject: [PATCH] [IMP] orm: improve error message when NOT NULL constraint is violated bzr revid: odo@openerp.com-20100824160515-07jobymgifm3k4vl --- bin/osv/osv.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/osv/osv.py b/bin/osv/osv.py index 0086e351d05..f75aee95381 100644 --- a/bin/osv/osv.py +++ b/bin/osv/osv.py @@ -66,7 +66,9 @@ class osv_pool(netsvc.Service): if key in inst[0]: self.abortResponse(1, 'Constraint Error', 'warning', self._sql_error[key]) if inst.pgcode == errorcodes.NOT_NULL_VIOLATION: - msg = 'Sorry, this record cannot be deleted at the moment because other records still reference it.' + msg = 'The operation cannot be completed, probably due to the following:\n' \ + '- deletion: you may be trying to delete a record while other records still reference it\n' \ + '- creation/update: a mandatory field is not correctly set' self.logger.debug("IntegrityError", exc_info=True) try: context = inst.pgerror.split('"public".')[1]