From 738e60c6ebf69bfbd7238fb35b4763fee4ca17d9 Mon Sep 17 00:00:00 2001 From: Nans Lefebvre Date: Fri, 28 Dec 2018 09:09:52 +0000 Subject: [PATCH] [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 --- odoo/service/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/service/model.py b/odoo/service/model.py index e263a581be2..dbd59dd87ff 100644 --- a/odoo/service/model.py +++ b/odoo/service/model.py @@ -138,7 +138,7 @@ def check(f): pass raise ValidationError(msg) else: - raise ValidationError(inst[0]) + raise ValidationError(inst.args[0]) return wrapper