[FIX] service: fix integrity error display

During the installation of a module, an IntegrityError can be raised,
e.g. if some module data already exists in the database
(as in the case of a module which uninstallation did not remove its data).

In Python2 it was possible to use such a psycopg2.IntegrityError with i[0]
to get its error message, while this raises an exception in Python3,
i.args[0] is needed.

As a result the log would contain an exception within an exception instead of
displaying an error to the user.

opw 1916374

closes odoo/odoo#29787
This commit is contained in:
Nans Lefebvre
2018-12-28 14:27:11 +00:00
parent fe381f95b7
commit 738e60c6eb
+1 -1
View File
@@ -138,7 +138,7 @@ def check(f):
pass
raise ValidationError(msg)
else:
raise ValidationError(inst[0])
raise ValidationError(inst.args[0])
return wrapper