Tours are automatically disabled when the demo data are enabled on at least one module. To ensure that, when giving the session_info object, we read on the `ir.module.module` model to check whether some of them have demo data. Before this commit, this check only relied on the user's `is_admin` flag, which does not give read access on the `ir.module.module` model. Now, a `sudo` ensures that any admin user can read on the model. closes odoo/odoo#76864 X-original-commit: 3a8d30d51a392f42d83d24b5f865f77b05205b50 Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
18 lines
586 B
Python
18 lines
586 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import models
|
|
from odoo.http import request
|
|
|
|
|
|
class Http(models.AbstractModel):
|
|
_inherit = 'ir.http'
|
|
|
|
def session_info(self):
|
|
result = super().session_info()
|
|
if result['is_admin']:
|
|
demo_modules_count = self.env['ir.module.module'].sudo().search_count([('demo', '=', True)])
|
|
result['web_tours'] = request.env['web_tour.tour'].get_consumed_tours()
|
|
result['tour_disable'] = demo_modules_count > 0
|
|
return result
|