[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) <tbe@odoo.com>
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
This commit is contained in:
Julien Castiaux
2020-10-08 14:59:47 +00:00
parent 5721b035a7
commit ed22cea4a4
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -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):
+2 -2
View File
@@ -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