28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
import odoo
|
|
from odoo import api, models, fields
|
|
from odoo.http import request
|
|
from odoo import http
|
|
|
|
class IrHttp(models.AbstractModel):
|
|
_inherit = 'ir.http'
|
|
|
|
def session_info(self):
|
|
info = super().session_info()
|
|
info["master_background_url"] = False
|
|
info["master_glass_effect"] = False
|
|
active_master = http.request.session.get("active_master")
|
|
if active_master:
|
|
info['user_context']['active_master'] = active_master
|
|
master = request.env['master.control'].sudo().search(
|
|
[('code', '=', active_master)],
|
|
limit=1
|
|
)
|
|
if master.use_custom_bg and master.background_image:
|
|
info["master_background_url"] = (
|
|
f"/web/image/master.control/{master.id}/background_image"
|
|
)
|
|
if master.enable_glass_effect:
|
|
info["master_glass_effect"] = master.enable_glass_effect
|
|
else:
|
|
info['user_context']['active_master'] = ''
|
|
return info |