summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Castiaux <juc@odoo.com>2020-04-15 14:52:08 +0000
committerJulien Castiaux <juc@odoo.com>2020-05-14 14:00:41 +0000
commitb6537c4335356ed660d2acbd914783d4ceea2521 (patch)
tree6baa8e51fe964efea680676facfc56434635a761
parent55cb0de1dbbce55297d167335b76f0654124efb8 (diff)
[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>
-rw-r--r--odoo/exceptions.py30
-rw-r--r--odoo/osv/__init__.py1
-rw-r--r--odoo/osv/osv.py13
3 files changed, 34 insertions, 10 deletions
diff --git a/odoo/exceptions.py b/odoo/exceptions.py
index 8400194e75a..43281b8bca9 100644
--- a/odoo/exceptions.py
+++ b/odoo/exceptions.py
@@ -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)
diff --git a/odoo/osv/__init__.py b/odoo/osv/__init__.py
index 2903e8d9121..9399e4410fb 100644
--- a/odoo/osv/__init__.py
+++ b/odoo/osv/__init__.py
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
+from . import osv
diff --git a/odoo/osv/osv.py b/odoo/osv/osv.py
new file mode 100644
index 00000000000..c0de9c0973e
--- /dev/null
+++ b/odoo/osv/osv.py
@@ -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 # ;-)