summaryrefslogtreecommitdiff
path: root/odoo
diff options
context:
space:
mode:
authorRaphael Collet <rco@odoo.com>2019-04-10 08:16:33 +0000
committerRaphael Collet <rco@odoo.com>2019-07-08 13:51:35 +0000
commitc552fb7a618afe2feea2e0358ead9eb6ebff0c94 (patch)
treedff502e0d0ced6cea06c940e664533ff175ae9c7 /odoo
parentfa5037650db987c0aece183758d59ce6026add4e (diff)
[IMP] api: remove deprecated decorators
Diffstat (limited to 'odoo')
-rw-r--r--odoo/addons/base/models/decimal_precision.py5
-rw-r--r--odoo/addons/base/models/ir_actions.py1
-rw-r--r--odoo/addons/base/models/ir_actions_report.py1
-rw-r--r--odoo/addons/base/models/ir_attachment.py1
-rw-r--r--odoo/addons/base/models/ir_config_parameter.py1
-rw-r--r--odoo/addons/base/models/ir_filters.py1
-rw-r--r--odoo/addons/base/models/ir_logging.py1
-rw-r--r--odoo/addons/base/models/ir_model.py5
-rw-r--r--odoo/addons/base/models/ir_translation.py2
-rw-r--r--odoo/addons/base/models/ir_ui_view.py2
-rw-r--r--odoo/addons/base/models/res_company.py1
-rw-r--r--odoo/addons/base/models/res_config.py2
-rw-r--r--odoo/addons/base/models/res_lang.py1
-rw-r--r--odoo/addons/base/models/res_partner.py1
-rw-r--r--odoo/addons/test_performance/models/models.py1
-rw-r--r--odoo/api.py312
-rw-r--r--odoo/models.py14
17 files changed, 7 insertions, 345 deletions
diff --git a/odoo/addons/base/models/decimal_precision.py b/odoo/addons/base/models/decimal_precision.py
index 9d1e67a22b3..dec400b1328 100644
--- a/odoo/addons/base/models/decimal_precision.py
+++ b/odoo/addons/base/models/decimal_precision.py
@@ -32,11 +32,6 @@ class DecimalPrecision(models.Model):
res = self.env.cr.fetchone()
return res[0] if res else 2
- @api.model_cr
- def clear_cache(self):
- """ Deprecated, use `clear_caches` instead. """
- self.clear_caches()
-
@api.model_create_multi
def create(self, vals_list):
res = super(DecimalPrecision, self).create(vals_list)
diff --git a/odoo/addons/base/models/ir_actions.py b/odoo/addons/base/models/ir_actions.py
index 94d1abbd940..66d11d4bd6e 100644
--- a/odoo/addons/base/models/ir_actions.py
+++ b/odoo/addons/base/models/ir_actions.py
@@ -283,7 +283,6 @@ class IrActionsActWindowView(models.Model):
act_window_id = fields.Many2one('ir.actions.act_window', string='Action', ondelete='cascade')
multi = fields.Boolean(string='On Multiple Doc.', help="If set to true, the action will not be displayed on the right toolbar of a form view.")
- @api.model_cr_context
def _auto_init(self):
res = super(IrActionsActWindowView, self)._auto_init()
tools.create_unique_index(self._cr, 'act_window_view_unique_mode_per_action',
diff --git a/odoo/addons/base/models/ir_actions_report.py b/odoo/addons/base/models/ir_actions_report.py
index 51ef9b9e32b..22807bdb6a0 100644
--- a/odoo/addons/base/models/ir_actions_report.py
+++ b/odoo/addons/base/models/ir_actions_report.py
@@ -765,7 +765,6 @@ class IrActionsReport(models.Model):
return None
return render_func(res_ids, data=data)
- @api.noguess
def report_action(self, docids, data=None, config=True):
"""Return an action of type ir.actions.report.
diff --git a/odoo/addons/base/models/ir_attachment.py b/odoo/addons/base/models/ir_attachment.py
index 734be5f88e9..8b191edb210 100644
--- a/odoo/addons/base/models/ir_attachment.py
+++ b/odoo/addons/base/models/ir_attachment.py
@@ -300,7 +300,6 @@ class IrAttachment(models.Model):
mimetype = fields.Char('Mime Type', readonly=True)
index_content = fields.Text('Indexed Content', readonly=True, prefetch=False)
- @api.model_cr_context
def _auto_init(self):
res = super(IrAttachment, self)._auto_init()
tools.create_index(self._cr, 'ir_attachment_res_idx',
diff --git a/odoo/addons/base/models/ir_config_parameter.py b/odoo/addons/base/models/ir_config_parameter.py
index 75be28c9359..32e7a838854 100644
--- a/odoo/addons/base/models/ir_config_parameter.py
+++ b/odoo/addons/base/models/ir_config_parameter.py
@@ -39,7 +39,6 @@ class IrConfigParameter(models.Model):
('key_uniq', 'unique (key)', 'Key must be unique.')
]
- @api.model_cr
@mute_logger('odoo.addons.base.models.ir_config_parameter')
def init(self, force=False):
"""
diff --git a/odoo/addons/base/models/ir_filters.py b/odoo/addons/base/models/ir_filters.py
index 547302be38b..75845870224 100644
--- a/odoo/addons/base/models/ir_filters.py
+++ b/odoo/addons/base/models/ir_filters.py
@@ -150,7 +150,6 @@ class IrFilters(models.Model):
('name_model_uid_unique', 'unique (name, model_id, user_id, action_id)', 'Filter names must be unique'),
]
- @api.model_cr_context
def _auto_init(self):
result = super(IrFilters, self)._auto_init()
# Use unique index to implement unique constraint on the lowercase name (not possible using a constraint)
diff --git a/odoo/addons/base/models/ir_logging.py b/odoo/addons/base/models/ir_logging.py
index 30fcaf3bd1d..567b95264d2 100644
--- a/odoo/addons/base/models/ir_logging.py
+++ b/odoo/addons/base/models/ir_logging.py
@@ -32,7 +32,6 @@ class IrLogging(models.Model):
func = fields.Char(string='Function', required=True)
line = fields.Char(required=True)
- @api.model_cr
def init(self):
super(IrLogging, self).init()
self._cr.execute("select 1 from information_schema.constraint_column_usage where table_name = 'ir_logging' and constraint_name = 'ir_logging_write_uid_fkey'")
diff --git a/odoo/addons/base/models/ir_model.py b/odoo/addons/base/models/ir_model.py
index a0337f85182..269091f2843 100644
--- a/odoo/addons/base/models/ir_model.py
+++ b/odoo/addons/base/models/ir_model.py
@@ -1191,7 +1191,7 @@ class IrModelAccess(models.Model):
self._cr.execute(query, (model_name, tuple(group_ids)))
return bool(self._cr.rowcount)
- @api.model_cr
+ @api.model
def group_names_with_access(self, model_name, access_mode):
""" Return the names of visible groups which have been granted
``access_mode`` on the model ``model_name``.
@@ -1288,7 +1288,7 @@ class IrModelAccess(models.Model):
def unregister_cache_clearing_method(cls, model, method):
cls.__cache_clearing_methods.discard((model, method))
- @api.model_cr
+ @api.model
def call_cache_clearing_methods(self):
self.invalidate_cache()
self.check.clear_cache(self) # clear the cache of check function
@@ -1352,7 +1352,6 @@ class IrModelData(models.Model):
for res in self:
res.reference = "%s,%s" % (res.model, res.res_id)
- @api.model_cr_context
def _auto_init(self):
res = super(IrModelData, self)._auto_init()
tools.create_unique_index(self._cr, 'ir_model_data_module_name_uniq_index',
diff --git a/odoo/addons/base/models/ir_translation.py b/odoo/addons/base/models/ir_translation.py
index 373e5f5e8b0..b4fcfc1481f 100644
--- a/odoo/addons/base/models/ir_translation.py
+++ b/odoo/addons/base/models/ir_translation.py
@@ -247,7 +247,6 @@ class IrTranslation(models.Model):
''' the source term is stored on 'src' field '''
return [('src', operator, value)]
- @api.model_cr_context
def _auto_init(self):
res = super(IrTranslation, self)._auto_init()
# Add separate md5 index on src (no size limit on values, and good performance).
@@ -759,7 +758,6 @@ class IrTranslation(models.Model):
""" Return a cursor-like object for fast inserting translations """
return IrTranslationImport(self)
- @api.model_cr_context
def load_module_terms(self, modules, langs):
""" Load PO files of the given modules for the given languages. """
# make sure the given languages are active
diff --git a/odoo/addons/base/models/ir_ui_view.py b/odoo/addons/base/models/ir_ui_view.py
index 622f4de1645..8a8d88bc17a 100644
--- a/odoo/addons/base/models/ir_ui_view.py
+++ b/odoo/addons/base/models/ir_ui_view.py
@@ -101,7 +101,6 @@ class ViewCustom(models.Model):
return self.browse(view_ids).name_get()
return super(ViewCustom, self)._name_search(name, args=args, operator=operator, limit=limit, name_get_uid=name_get_uid)
- @api.model_cr_context
def _auto_init(self):
res = super(ViewCustom, self)._auto_init()
tools.create_index(self._cr, 'ir_ui_view_custom_user_id_ref_id',
@@ -408,7 +407,6 @@ actual arch.
"Invalid key: QWeb view should have a key"),
]
- @api.model_cr_context
def _auto_init(self):
res = super(View, self)._auto_init()
tools.create_index(self._cr, 'ir_ui_view_model_type_inherit_id',
diff --git a/odoo/addons/base/models/res_company.py b/odoo/addons/base/models/res_company.py
index 2b69228c655..fb9146aea6b 100644
--- a/odoo/addons/base/models/res_company.py
+++ b/odoo/addons/base/models/res_company.py
@@ -102,7 +102,6 @@ class Company(models.Model):
]
- @api.model_cr
def init(self):
for company in self.search([('paperformat_id', '=', False)]):
paperformat_euro = self.env.ref('base.paperformat_euro', False)
diff --git a/odoo/addons/base/models/res_config.py b/odoo/addons/base/models/res_config.py
index e5b584a5768..b8617a09d5a 100644
--- a/odoo/addons/base/models/res_config.py
+++ b/odoo/addons/base/models/res_config.py
@@ -695,7 +695,7 @@ class ResConfigSettings(models.TransientModel, ResConfigModuleInstallationMixin)
model_name, field_name = full_field_name.rsplit('.', 1)
return self.env[model_name].fields_get([field_name])[field_name]['string']
- @api.model_cr_context
+ @api.model
def get_config_warning(self, msg):
"""
Helper: return a Warning exception with the given message where the %(field:xxx)s
diff --git a/odoo/addons/base/models/res_lang.py b/odoo/addons/base/models/res_lang.py
index 9e37a5b7963..6fcd82354b6 100644
--- a/odoo/addons/base/models/res_lang.py
+++ b/odoo/addons/base/models/res_lang.py
@@ -82,7 +82,6 @@ class Lang(models.Model):
except Exception:
raise ValidationError(warning)
- @api.model_cr
def _register_hook(self):
# check that there is at least one active language
if not self.search_count([]):
diff --git a/odoo/addons/base/models/res_partner.py b/odoo/addons/base/models/res_partner.py
index 1fdcd5afe5b..d6677b972ac 100644
--- a/odoo/addons/base/models/res_partner.py
+++ b/odoo/addons/base/models/res_partner.py
@@ -241,7 +241,6 @@ class Partner(models.Model):
('check_name', "CHECK( (type='contact' AND name IS NOT NULL) or (type!='contact') )", 'Contacts require a name.'),
]
- @api.model_cr
def init(self):
self._cr.execute("""SELECT indexname FROM pg_indexes WHERE indexname = 'res_partner_vat_index'""")
if not self._cr.fetchone():
diff --git a/odoo/addons/test_performance/models/models.py b/odoo/addons/test_performance/models/models.py
index f1c51453b47..5874d0a784e 100644
--- a/odoo/addons/test_performance/models/models.py
+++ b/odoo/addons/test_performance/models/models.py
@@ -35,7 +35,6 @@ class LineModel(models.Model):
base_id = fields.Many2one('test_performance.base', required=True, ondelete='cascade')
value = fields.Integer()
- @api.model_cr
def init(self):
# line values should be unique per "base" - useful for testing corner cases with unique lines
tools.create_unique_index(self._cr, 'test_performance_line_uniq', self._table, ['base_id', 'value'])
diff --git a/odoo/api.py b/odoo/api.py
index 99fcdcaa6e2..ab96c9f64fd 100644
--- a/odoo/api.py
+++ b/odoo/api.py
@@ -33,14 +33,8 @@
__all__ = [
'Environment',
- 'Meta', 'guess', 'noguess',
+ 'Meta',
'model', 'multi',
- 'model_cr', 'model_cr_context',
- 'cr', 'cr_context',
- 'cr_uid', 'cr_uid_context',
- 'cr_uid_id', 'cr_uid_id_context',
- 'cr_uid_ids', 'cr_uid_ids_context',
- 'cr_uid_records', 'cr_uid_records_context',
'constrains', 'depends', 'onchange', 'returns',
'call_kw',
]
@@ -48,7 +42,7 @@ __all__ = [
import logging
from collections import defaultdict, Mapping
from contextlib import contextmanager
-from inspect import currentframe, getargspec
+from inspect import getargspec
from pprint import pformat
from weakref import WeakSet
@@ -69,12 +63,8 @@ _logger = logging.getLogger(__name__)
#
# On wrapping method only:
# - method._api: decorator function, used for re-applying decorator
-# - method._orig: original method
#
-WRAPPED_ATTRS = ('__module__', '__name__', '__doc__', '_constrains',
- '_depends', '_onchange', '_returns', 'clear_cache')
-
INHERITED_ATTRS = ('_returns',)
@@ -82,6 +72,7 @@ class Params(object):
def __init__(self, args, kwargs):
self.args = args
self.kwargs = kwargs
+
def __str__(self):
params = []
for arg in self.args:
@@ -106,13 +97,6 @@ class Meta(type):
# make the method inherit from decorators
value = propagate(getattr(parent, key, None), value)
- # guess calling convention if none is given
- if not hasattr(value, '_api'):
- try:
- value = guess(value)
- except TypeError:
- pass
-
if (getattr(value, '_api', None) or '').startswith('cr'):
_logger.warning("Deprecated method %s.%s in module %s", name, key, attrs.get('__module__'))
@@ -324,50 +308,6 @@ def multi(method):
return method
-def model_cr(method):
- """ Decorate a record-style method where ``self`` is a recordset, but its
- contents is not relevant, only the model is. Such a method::
-
- @api.model_cr
- def method(self, args):
- ...
-
- may be called in both record and traditional styles, like::
-
- # recs = model.browse(cr, uid, ids, context)
- recs.method(args)
-
- model.method(cr, args)
-
- Notice that no ``uid``, ``ids``, ``context`` are passed to the method in
- the traditional style.
- """
- method._api = 'model_cr'
- return method
-
-
-def model_cr_context(method):
- """ Decorate a record-style method where ``self`` is a recordset, but its
- contents is not relevant, only the model is. Such a method::
-
- @api.model_cr_context
- def method(self, args):
- ...
-
- may be called in both record and traditional styles, like::
-
- # recs = model.browse(cr, uid, ids, context)
- recs.method(args)
-
- model.method(cr, args, context=context)
-
- Notice that no ``uid``, ``ids`` are passed to the method in the
- traditional style.
- """
- method._api = 'model_cr_context'
- return method
-
-
_create_logger = logging.getLogger(__name__ + '.create')
@@ -412,252 +352,6 @@ def model_create_multi(method):
return wrapper
-def cr(method):
- """ Decorate a traditional-style method that takes ``cr`` as a parameter.
- Such a method may be called in both record and traditional styles, like::
-
- # recs = model.browse(cr, uid, ids, context)
- recs.method(args)
-
- model.method(cr, args)
- """
- method._api = 'cr'
- return method
-
-
-def cr_context(method):
- """ Decorate a traditional-style method that takes ``cr``, ``context`` as parameters. """
- method._api = 'cr_context'
- return method
-
-
-def cr_uid(method):
- """ Decorate a traditional-style method that takes ``cr``, ``uid`` as parameters. """
- method._api = 'cr_uid'
- return method
-
-
-def cr_uid_context(method):
- """ Decorate a traditional-style method that takes ``cr``, ``uid``, ``context`` as
- parameters. Such a method may be called in both record and traditional
- styles, like::
-
- # recs = model.browse(cr, uid, ids, context)
- recs.method(args)
-
- model.method(cr, uid, args, context=context)
- """
- method._api = 'cr_uid_context'
- return method
-
-
-def cr_uid_id(method):
- """ Decorate a traditional-style method that takes ``cr``, ``uid``, ``id`` as
- parameters. Such a method may be called in both record and traditional
- styles. In the record style, the method automatically loops on records.
- """
- method._api = 'cr_uid_id'
- return method
-
-
-def cr_uid_id_context(method):
- """ Decorate a traditional-style method that takes ``cr``, ``uid``, ``id``,
- ``context`` as parameters. Such a method::
-
- @api.cr_uid_id
- def method(self, cr, uid, id, args, context=None):
- ...
-
- may be called in both record and traditional styles, like::
-
- # rec = model.browse(cr, uid, id, context)
- rec.method(args)
-
- model.method(cr, uid, id, args, context=context)
- """
- method._api = 'cr_uid_id_context'
- return method
-
-
-def cr_uid_ids(method):
- """ Decorate a traditional-style method that takes ``cr``, ``uid``, ``ids`` as
- parameters. Such a method may be called in both record and traditional
- styles.
- """
- method._api = 'cr_uid_ids'
- return method
-
-
-def cr_uid_ids_context(method):
- """ Decorate a traditional-style method that takes ``cr``, ``uid``, ``ids``,
- ``context`` as parameters. Such a method::
-
- @api.cr_uid_ids_context
- def method(self, cr, uid, ids, args, context=None):
- ...
-
- may be called in both record and traditional styles, like::
-
- # recs = model.browse(cr, uid, ids, context)
- recs.method(args)
-
- model.method(cr, uid, ids, args, context=context)
-
- It is generally not necessary, see :func:`guess`.
- """
- method._api = 'cr_uid_ids_context'
- return method
-
-
-def cr_uid_records(method):
- """ Decorate a traditional-style method that takes ``cr``, ``uid``, a
- recordset of model ``self`` as parameters. Such a method::
-
- @api.cr_uid_records
- def method(self, cr, uid, records, args):
- ...
-
- may be called in both record and traditional styles, like::
-
- # records = model.browse(cr, uid, ids, context)
- records.method(args)
-
- model.method(cr, uid, records, args)
- """
- method._api = 'cr_uid_records'
- return method
-
-
-def cr_uid_records_context(method):
- """ Decorate a traditional-style method that takes ``cr``, ``uid``, a
- recordset of model ``self``, ``context`` as parameters. Such a method::
-
- @api.cr_uid_records_context
- def method(self, cr, uid, records, args, context=None):
- ...
-
- may be called in both record and traditional styles, like::
-
- # records = model.browse(cr, uid, ids, context)
- records.method(args)
-
- model.method(cr, uid, records, args, context=context)
- """
- method._api = 'cr_uid_records_context'
- return method
-
-
-def v7(method_v7):
- """ Decorate a method that supports the old-style api only. A new-style api
- may be provided by redefining a method with the same name and decorated
- with :func:`~.v8`::
-
- @api.v7
- def foo(self, cr, uid, ids, context=None):
- ...
-
- @api.v8
- def foo(self):
- ...
-
- Special care must be taken if one method calls the other one, because
- the method may be overridden! In that case, one should call the method
- from the current class (say ``MyClass``), for instance::
-
- @api.v7
- def foo(self, cr, uid, ids, context=None):
- # Beware: records.foo() may call an overriding of foo()
- records = self.browse(cr, uid, ids, context)
- return MyClass.foo(records)
-
- Note that the wrapper method uses the docstring of the first method.
- """
- # retrieve method_v8 from the caller's frame
- frame = currentframe().f_back
- return frame.f_locals.get(method_v7.__name__, method_v7)
-
-
-def v8(method_v8):
- """ Decorate a method that supports the new-style api only. An old-style api
- may be provided by redefining a method with the same name and decorated
- with :func:`~.v7`::
-
- @api.v8
- def foo(self):
- ...
-
- @api.v7
- def foo(self, cr, uid, ids, context=None):
- ...
-
- Note that the wrapper method uses the docstring of the first method.
- """
- if method_v8.__name__ == 'read':
- return multi(method_v8)
- method_v8._api = 'v8'
- return method_v8
-
-
-def noguess(method):
- """ Decorate a method to prevent any effect from :func:`guess`. """
- method._api = None
- return method
-
-
-def guess(method):
- """ Decorate ``method`` to make it callable in both traditional and record
- styles. This decorator is applied automatically by the model's
- metaclass, and has no effect on already-decorated methods.
-
- The API style is determined by heuristics on the parameter names: ``cr``
- or ``cursor`` for the cursor, ``uid`` or ``user`` for the user id,
- ``id`` or ``ids`` for a list of record ids, and ``context`` for the
- context dictionary. If a traditional API is recognized, one of the
- decorators :func:`cr`, :func:`cr_context`, :func:`cr_uid`,
- :func:`cr_uid_context`, :func:`cr_uid_id`, :func:`cr_uid_id_context`,
- :func:`cr_uid_ids`, :func:`cr_uid_ids_context` is applied on the method.
-
- Method calls are considered traditional style when their first parameter
- is a database cursor.
- """
- if hasattr(method, '_api'):
- return method
-
- # introspection on argument names to determine api style
- args, vname, kwname, defaults = getargspec(method)
- names = tuple(args) + (None,) * 4
-
- if names[0] == 'self':
- if names[1] in ('cr', 'cursor'):
- if names[2] in ('uid', 'user'):
- if names[3] == 'ids':
- if 'context' in names or kwname:
- return cr_uid_ids_context(method)
- else:
- return cr_uid_ids(method)
- elif names[3] == 'id' or names[3] == 'res_id':
- if 'context' in names or kwname:
- return cr_uid_id_context(method)
- else:
- return cr_uid_id(method)
- elif 'context' in names or kwname:
- return cr_uid_context(method)
- else:
- return cr_uid(method)
- elif 'context' in names:
- return cr_context(method)
- else:
- return cr(method)
-
- # no wrapping by default
- return noguess(method)
-
-
-def expected(decorator, func):
- """ Decorate ``func`` with ``decorator`` if ``func`` is not wrapped yet. """
- return decorator(func) if not hasattr(func, '_api') else func
-
-
def _call_kw_model(method, self, args, kwargs):
context, args, kwargs = split_context(method, args, kwargs)
recs = self.with_context(context or {})
diff --git a/odoo/models.py b/odoo/models.py
index 0ffac157bc6..e9c09e5625f 100644
--- a/odoo/models.py
+++ b/odoo/models.py
@@ -298,7 +298,6 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
"""
pass
- @api.model_cr_context
def _reflect(self):
""" Reflect the model and its fields in the models 'ir.model' and
'ir.model.fields'. Also create entries in 'ir.model.data' if the key
@@ -2281,7 +2280,6 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
else:
return '"%s"."%s"' % (alias, fname)
- @api.model_cr
def _parent_store_compute(self):
""" Compute parent_path field from scratch. """
if not self._parent_store:
@@ -2320,7 +2318,6 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
self.invalidate_cache(['parent_path'])
return True
- @api.model_cr
def _check_removed_columns(self, log=False):
# iterate on the database columns to drop the NOT NULL constraints of
# fields which were required but have been removed (or will be added by
@@ -2343,7 +2340,6 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
if row['attnotnull']:
tools.drop_not_null(cr, self._table, row['attname'])
- @api.model_cr_context
def _init_column(self, column_name):
""" Initialize the value of the given column for existing rows. """
# get the default value; ideally, we should use default_get(), but it
@@ -2375,7 +2371,6 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
self.env.cr.execute('SELECT 1 FROM "%s" LIMIT 1' % self._table)
return self.env.cr.rowcount
- @api.model_cr_context
def _auto_init(self):
""" Initialize the database schema of ``self``:
- create the corresponding table,
@@ -2446,14 +2441,12 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
if parent_path_compute:
self._parent_store_compute()
- @api.model_cr
def init(self):
""" This method is called after :meth:`~._auto_init`, and may be
overridden to create or modify a model's database schema.
"""
pass
- @api.model_cr
def _create_parent_columns(self):
tools.create_column(self._cr, self._table, 'parent_path', 'VARCHAR')
if 'parent_path' not in self._fields:
@@ -2461,7 +2454,6 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
elif not self._fields['parent_path'].index:
_logger.error('parent_path field on model %s must be indexed! Add index=True to the field definition)', self._name)
- @api.model_cr
def _add_sql_constraints(self):
"""
@@ -2489,7 +2481,6 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
else:
process(key, definition)
- @api.model_cr
def _execute_sql(self):
""" Execute the SQL code from the _sql attribute (if any)."""
if hasattr(self, "_sql"):
@@ -4527,7 +4518,6 @@ Fields:
"""
return cls._transient
- @api.model_cr
def _transient_clean_rows_older_than(self, seconds):
assert self._transient, "Model %s is not transient, it cannot be vacuumed!" % self._name
# Never delete rows used in last 5 minutes
@@ -4539,7 +4529,6 @@ Fields:
ids = [x[0] for x in self._cr.fetchall()]
self.sudo().browse(ids).unlink()
- @api.model_cr
def _transient_clean_old_rows(self, max_count):
# Check how many rows we have in the table
self._cr.execute("SELECT count(*) AS row_count FROM " + self._table)
@@ -4682,7 +4671,6 @@ Fields:
for record in self:
record.active = not record.active
- @api.model_cr
def _register_hook(self):
""" stuff to do right after the registry is built """
pass
@@ -4714,7 +4702,7 @@ Fields:
origin = getattr(cls, name)
method.origin = origin
# propagate decorators from origin to method, and apply api decorator
- wrapped = api.guess(api.propagate(origin, method))
+ wrapped = api.propagate(origin, method)
wrapped.origin = origin
setattr(cls, name, wrapped)