mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-22 15:12:01 +02:00
Initial commit: Core packages
This commit is contained in:
commit
12c29a983b
9512 changed files with 8379910 additions and 0 deletions
27
odoo-bringout-oca-ocb-mail/mail/models/ir_http.py
Normal file
27
odoo-bringout-oca-ocb-mail/mail/models/ir_http.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import odoo
|
||||
from odoo import models
|
||||
from odoo.http import request
|
||||
|
||||
|
||||
class IrHttp(models.AbstractModel):
|
||||
_inherit = 'ir.http'
|
||||
|
||||
def session_info(self):
|
||||
user = self.env.user
|
||||
result = super(IrHttp, self).session_info()
|
||||
if self.env.user._is_internal():
|
||||
result['notification_type'] = user.notification_type
|
||||
guest = self.env['mail.guest']._get_guest_from_context()
|
||||
if not request.session.uid and guest:
|
||||
user_context = {'lang': guest.lang}
|
||||
mods = odoo.conf.server_wide_modules or []
|
||||
lang = user_context.get("lang")
|
||||
translation_hash = self.env['ir.http'].sudo().get_web_translations_hash(mods, lang)
|
||||
result['cache_hashes']['translations'] = translation_hash
|
||||
result.update({
|
||||
'name': guest.name,
|
||||
'user_context': user_context,
|
||||
})
|
||||
return result
|
||||
Loading…
Add table
Add a link
Reference in a new issue