From ed22cea4a41c4f1f11d9458db7271c2a0f2ce821 Mon Sep 17 00:00:00 2001 From: Julien Castiaux Date: Wed, 7 Oct 2020 16:14:40 +0000 Subject: [PATCH] [FIX] base: fix exception retro-compatibility-aid Restore the old signature of except_orm. opw-2354525 opw-2355980 closes odoo/odoo#59531 X-original-commit: 29e844a86508b39031fa8c3f1a2ef3735f71e6f2 Signed-off-by: Toufik Benjaa (tbe) Signed-off-by: Julien Castiaux --- odoo/exceptions.py | 4 ++-- odoo/osv/osv.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/odoo/exceptions.py b/odoo/exceptions.py index af5f17a6e6f..d0587176b65 100644 --- a/odoo/exceptions.py +++ b/odoo/exceptions.py @@ -125,9 +125,9 @@ class ValidationError(UserError): # Warning. class except_orm(UserError): - def __init__(self, *args, **kwargs): + def __init__(self, name, value=None): warnings.warn("except_orm is a deprecated alias to UserError.", DeprecationWarning) - super().__init__(*args, **kwargs) + super().__init__(f"{name}: {value}") class Warning(UserError): def __init__(self, *args, **kwargs): diff --git a/odoo/osv/osv.py b/odoo/osv/osv.py index c0de9c0973e..9d8bada8dae 100644 --- a/odoo/osv/osv.py +++ b/odoo/osv/osv.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from ..exceptions import UserError +from ..exceptions import except_orm from ..models import Model, TransientModel, AbstractModel # Deprecated, kept for backward compatibility. -except_osv = UserError +except_osv = except_orm # Deprecated, kept for backward compatibility. osv = Model