From 1187bb798a6d7e35b493b09d7b17aa7852d69012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Voet=20=28ryv=29?= Date: Wed, 27 Oct 2021 11:29:29 +0000 Subject: [PATCH] [REM] base: remove unused method from ir_rule Remove unused methods from ir_rule.py: - unused _eval_context_for_combinations - Depreciated and unused domain_get method Depreciate duplicate method IrRule.clear_cache() closes odoo/odoo#79073 Signed-off-by: Raphael Collet --- odoo/addons/base/models/ir_rule.py | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/odoo/addons/base/models/ir_rule.py b/odoo/addons/base/models/ir_rule.py index 5a13120073c..15e9efd3a64 100644 --- a/odoo/addons/base/models/ir_rule.py +++ b/odoo/addons/base/models/ir_rule.py @@ -32,14 +32,6 @@ class IrRule(models.Model): 'Rule must have at least one checked access right !'), ] - def _eval_context_for_combinations(self): - """Returns a dictionary to use as evaluation context for - ir.rule domains, when the goal is to obtain python lists - that are easier to parse and combine, but not to - actually execute them.""" - return {'user': tools.unquote('user'), - 'time': tools.unquote('time')} - @api.model def _eval_context(self): """Returns a dictionary to use as evaluation context for @@ -169,28 +161,9 @@ class IrRule(models.Model): @api.model def clear_cache(self): - """ Deprecated, use `clear_caches` instead. """ + warnings.warn("Deprecated IrRule.clear_cache(), use IrRule.clear_caches() instead", DeprecationWarning) self.clear_caches() - @api.model - def domain_get(self, model_name, mode='read'): - # this method is now unsafe, since it returns a list of tables which - # does not contain the joins present in the generated Query object - warnings.warn( - "Unsafe and deprecated IrRule.domain_get(), " - "use IrRule._compute_domain() and expression().query instead", - DeprecationWarning, - ) - dom = self._compute_domain(model_name, mode) - if dom: - # _where_calc is called as superuser. This means that rules can - # involve objects on which the real uid has no acces rights. - # This means also there is no implicit restriction (e.g. an object - # references another object the user can't see). - query = self.env[model_name].sudo()._where_calc(dom, active_test=False) - return query.where_clause, query.where_clause_params, query.tables - return [], [], ['"%s"' % self.env[model_name]._table] - def unlink(self): res = super(IrRule, self).unlink() self.clear_caches()