mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
Add web_fix_modules_load
This commit is contained in:
20
web_fix_modules_load/models/ir_module.py
Normal file
20
web_fix_modules_load/models/ir_module.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# Copyright 2022 Camptocamp SA
|
||||
# @author Simone Orsi <simahawk@gmail.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
import json
|
||||
|
||||
from odoo import models
|
||||
|
||||
from odoo.addons.web.controllers.main import module_boot
|
||||
|
||||
|
||||
class IrModule(models.Model):
|
||||
_inherit = "ir.module.module"
|
||||
|
||||
def _session_modules_info(self):
|
||||
"""Load modules info and return their mapping."""
|
||||
module_names = module_boot(self.env.cr.dbname)
|
||||
modules = self.sudo().search([("name", "in", module_names)])
|
||||
data = {mod.name: {"id": mod.id} for mod in modules}
|
||||
return json.dumps(data)
|
||||
Reference in New Issue
Block a user