[REV] base: restore removed deprecated osv and exceptions
To ensure backward compatibility, stuff removed by ab4000fb3 have
been restored.
closes odoo/odoo#49603
Task: 2234749
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
This commit is contained in:
+20
-10
@@ -39,16 +39,6 @@ class UserError(Exception):
|
||||
return self.args[0]
|
||||
|
||||
|
||||
# deprecated due to collision with builtins, kept for compatibility
|
||||
class Warning(UserError):
|
||||
def __init__(self, *args, **kwargs):
|
||||
warnings.warn(
|
||||
"Warning is a deprecated alias to UserError and is going to be "
|
||||
"removed in a future version.",
|
||||
DeprecationWarning)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
||||
class RedirectWarning(Exception):
|
||||
""" Warning with a possibility to redirect the user instead of simply
|
||||
displaying the warning message.
|
||||
@@ -126,3 +116,23 @@ class ValidationError(UserError):
|
||||
|
||||
When you try to create a new user with a login which already exist in the db.
|
||||
"""
|
||||
|
||||
|
||||
# Deprecated exceptions, only kept for backward compatibility, may be
|
||||
# removed in the future *without* any futher notice than the Deprecation
|
||||
# Warning.
|
||||
|
||||
class except_orm(UserError):
|
||||
def __init__(self, *args, **kwargs):
|
||||
warnings.warn("except_orm is a deprecated alias to UserError.", DeprecationWarning)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
class Warning(UserError):
|
||||
def __init__(self, *args, **kwargs):
|
||||
warnings.warn("Warning is a deprecated alias to UserError.", DeprecationWarning)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
class QWebException(Exception):
|
||||
def __init__(self, *args, **kwargs):
|
||||
warnings.warn("qweb.QWebException is the exception you are looking for.", DeprecationWarning)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import osv
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from ..exceptions import UserError
|
||||
from ..models import Model, TransientModel, AbstractModel
|
||||
|
||||
# Deprecated, kept for backward compatibility.
|
||||
except_osv = UserError
|
||||
|
||||
# Deprecated, kept for backward compatibility.
|
||||
osv = Model
|
||||
osv_memory = TransientModel
|
||||
osv_abstract = AbstractModel # ;-)
|
||||
Reference in New Issue
Block a user