This commit changes the way tours are automatically disabled when in demo data. Previously, an override of the assets_common template was applied by a file loaded in the web_tour demo data, ensuring that the tours are disabled when demo data are loaded in the database. Now, a "tour_disable" boolean will be given to the session_info object to determine whether the tour manager must be disabled, meaning that it will automatically consume all registered tours. This has been done to improve consistency in asset bundles declarations by reducing them to the simplest possible templates. Part of task: 2352566 Co-authored-by: Julien Mougenot <jum@odoo.com> Co-authored-by: Simon Genin <ges@odoo.com>
18 lines
579 B
Python
18 lines
579 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'].search_count([('demo', '=', True)])
|
|
result['web_tours'] = request.env['web_tour.tour'].get_consumed_tours()
|
|
result['tour_disable'] = demo_modules_count > 0
|
|
return result
|