Skip to Content
Menu
This question has been flagged
2 Replies
2503 Views

As you guys know, when we login to the odoo it is showing the discuss page, but instead of discuss i want to show my custom module first. can anyone tell me how can I do that using code? i know the FE side but i have to do it manually for every user, I need the code side help

Avatar
Discard
Best Answer

Hello Ashutosh


there is a method called "session_info" in HTTP model and web/models/ir_http.py file.

this method pass "home_action_id" : user.action_id.id to front env via javascript.

class Http(models.AbstractModel):
_inherit = 'ir.http'

def session_info(self):
user = request.env.user
version_info = odoo.service.common.exp_version()

session_uid = request.session.uid
user_context = request.session.get_context() if session_uid else {}
IrConfigSudo = self.env['ir.config_parameter'].sudo()
max_file_upload_size = int(IrConfigSudo.get_param(
'web.max_file_upload_size',
default=128 * 1024 * 1024, # 128MiB
))
mods = odoo.conf.server_wide_modules or []
lang = user_context.get("lang")
translation_hash = request.env['ir.translation'].sudo().get_web_translations_hash(mods, lang)
session_info = {
"uid": session_uid,
"is_system": user._is_system() if session_uid else False,
"is_admin": user._is_admin() if session_uid else False,
"user_context": user_context,
"db": request.session.db,
"server_version": version_info.get('server_version'),
"server_version_info": version_info.get('server_version_info'),
"support_url": "https://www.odoo.com/buy",
"name": user.name,
"username": user.login,
"partner_display_name": user.partner_id.display_name,
"company_id": user.company_id.id if session_uid else None, # YTI TODO: Remove this from the user context
"partner_id": user.partner_id.id if session_uid and user.partner_id else None,
"web.base.url": IrConfigSudo.get_param('web.base.url', default=''),
"active_ids_limit": int(IrConfigSudo.get_param('web.active_ids_limit', default='20000')),
'profile_session': request.session.profile_session,
'profile_collectors': request.session.profile_collectors,
'profile_params': request.session.profile_params,
"max_file_upload_size": max_file_upload_size,
"home_action_id": user.action_id.id,
"cache_hashes": {
"translations": translation_hash,
},
"currencies": self.sudo().get_currencies(),
}

Thanks & Regards,



CandidRoot Solutions Pvt. Ltd.

Mobile: (+91) 8849036209
Email: info@candidroot.com
Skype: live:candidroot
Web: https://www.candidroot.com
Address: 1229-1230, Iconic Shyamal, Near Shyamal Cross Road, Ahmedabad, Gujarat



Avatar
Discard
Author

Thank you Candidroot, i will try this solution and let you know. :)

Best Answer

go to your users preferences>>home action 
and u ca n select any action to start with

Avatar
Discard
Author

Thank you Rageh

Related Posts Replies Views Activity
2
Dec 24
3123
1
Dec 24
350
4
Nov 24
1364
1
Sep 24
1134
1
Sep 24
1202