'Add what\'s missing in ``query`` to implement all appropriate ir.rules
(using the ``model_name``\'s rules or the current model\'s rules if ``model_name`` is None)
:param query: the current query object'

@api.model
def _apply_ir_rules(self, query, mode='read'):

    if (self._uid == SUPERUSER_ID):
        return
    def apply_rule(clauses, params, tables, parent_model=None):
        '    :param    parent_model:    name    of    the    parent    model,    if    the    added\n                                                                                clause    comes    from    a    parent    model\n                                                '
        if clauses:
            if parent_model:
                parent_table = ('"%s"' % self.env[parent_model]._table)
                parent_alias = ('"%s"' % self._inherits_join_add(self, parent_model, query))
                clauses = [clause.replace(parent_table, parent_alias) for clause in clauses]
                tables = [(((parent_table + '    as    ') + parent_alias) if (table == parent_table) else table.replace(parent_table, parent_alias)) for table in tables]
            query.where_clause += clauses
            query.where_clause_params += params
            for table in tables:
                if (table not in query.tables):
                    query.tables.append(table)
    Rule = self.env['ir.rule']
    (where_clause, where_params, tables) = Rule.domain_get(self._name, mode)
    apply_rule(where_clause, where_params, tables)
    for parent_model in self._inherits:
        (where_clause, where_params, tables) = Rule.domain_get(parent_model, mode)
        apply_rule(where_clause, where_params, tables, parent_model)
