add web_window_title
This commit is contained in:
parent
c17ceb75a3
commit
190d1f09c2
11 changed files with 172 additions and 0 deletions
4
web_window_title/models/__init__.py
Normal file
4
web_window_title/models/__init__.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import ir_ui_view
|
||||
from . import res_config
|
||||
18
web_window_title/models/ir_ui_view.py
Normal file
18
web_window_title/models/ir_ui_view.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import logging
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
class View(models.Model):
|
||||
_inherit = 'ir.ui.view'
|
||||
|
||||
@api.model
|
||||
def _render_template(self, template, values=None):
|
||||
if template in ['web.login', 'web.webclient_bootstrap']:
|
||||
if not values:
|
||||
values = {}
|
||||
values["title"] = self.env['ir.config_parameter'].sudo().get_param("web.base.title", "")
|
||||
return super(View, self)._render_template(template, values)
|
||||
29
web_window_title/models/res_config.py
Normal file
29
web_window_title/models/res_config.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import logging
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
CONFIG_PARAM_WEB_WINDOW_TITLE = "web.base.title"
|
||||
|
||||
class ResConfigSettings(models.TransientModel):
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
web_window_title = fields.Char('Window Title')
|
||||
|
||||
@api.model
|
||||
def get_values(self):
|
||||
res = super(ResConfigSettings, self).get_values()
|
||||
ir_config = self.env['ir.config_parameter'].sudo()
|
||||
web_window_title = ir_config.get_param(CONFIG_PARAM_WEB_WINDOW_TITLE, default='')
|
||||
res.update(
|
||||
web_window_title=web_window_title
|
||||
)
|
||||
return res
|
||||
|
||||
def set_values(self):
|
||||
super(ResConfigSettings, self).set_values()
|
||||
ir_config = self.env['ir.config_parameter'].sudo()
|
||||
ir_config.set_param(CONFIG_PARAM_WEB_WINDOW_TITLE, self.web_window_title or "")
|
||||
Loading…
Add table
Add a link
Reference in a new issue