mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[FIX] web_dialog_size: Fix usage for non-admins and reduce calls (#954)
This addon had 2 problems after migrating to v11: 1. One call to backend's `ir.config_parameter.get_param` was done for each instantiated dialog, while the setting served for the whole session equally. 2. That model is now readable only by admin users, so non-admins couldn't use the default at all. Fixed now.
This commit is contained in:
1
web_dialog_size/models/__init__.py
Normal file
1
web_dialog_size/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import ir_config_parameter
|
||||
17
web_dialog_size/models/ir_config_parameter.py
Normal file
17
web_dialog_size/models/ir_config_parameter.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# Copyright 2018 Tecnativa - Jairo Llopis
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.models import api, Model
|
||||
from odoo.tools.safe_eval import const_eval
|
||||
|
||||
|
||||
class IrConfigParameter(Model):
|
||||
_inherit = "ir.config_parameter"
|
||||
|
||||
@api.model
|
||||
def get_web_dialog_size_config(self):
|
||||
get_param = self.sudo().get_param
|
||||
return {
|
||||
key: const_eval(get_param("web_dialog_size.%s" % key, "False"))
|
||||
for key in ["default_maximize"]
|
||||
}
|
||||
Reference in New Issue
Block a user