合并企业版代码(未测试,先提交到测试分支)
This commit is contained in:
36
web_enterprise/models/ir_http.py
Normal file
36
web_enterprise/models/ir_http.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import json
|
||||
|
||||
from odoo import models
|
||||
from odoo.http import request
|
||||
|
||||
|
||||
class Http(models.AbstractModel):
|
||||
_inherit = 'ir.http'
|
||||
|
||||
def webclient_rendering_context(self):
|
||||
""" Overrides community to prevent unnecessary load_menus request """
|
||||
return {
|
||||
'session_info': self.session_info(),
|
||||
}
|
||||
|
||||
def session_info(self):
|
||||
ICP = request.env['ir.config_parameter'].sudo()
|
||||
User = request.env['res.users']
|
||||
|
||||
if User.has_group('base.group_system'):
|
||||
warn_enterprise = 'admin'
|
||||
elif User.has_group('base.group_user'):
|
||||
warn_enterprise = 'user'
|
||||
else:
|
||||
warn_enterprise = False
|
||||
|
||||
result = super(Http, self).session_info()
|
||||
result['support_url'] = "https://www.odoo.com/help"
|
||||
if warn_enterprise:
|
||||
result['warning'] = warn_enterprise
|
||||
result['expiration_date'] = ICP.get_param('database.expiration_date')
|
||||
result['expiration_reason'] = ICP.get_param('database.expiration_reason')
|
||||
return result
|
||||
Reference in New Issue
Block a user