diff --git a/addons/education_portal/controllers/main.py b/addons/education_portal/controllers/main.py index 1504289..16b0296 100644 --- a/addons/education_portal/controllers/main.py +++ b/addons/education_portal/controllers/main.py @@ -281,3 +281,20 @@ class StudentPortalController(CustomerPortal): 'page_name': 'student_announcement_details', } return request.render("education_portal.portal_student_announcement_details", values) + +from odoo.addons.web.controllers.home import Home + +class StudentLoginRedirect(Home): + + def _login_redirect(self, uid, redirect=None): + redirect_url = super()._login_redirect(uid, redirect=redirect) + + # Check if the logged-in user is a student + user = request.env['res.users'].sudo().browse(uid) + + # If the user is a student and there is no specific redirect requested + # (or the redirect is just the default website home / or /my) + if user.student_id and (not redirect or redirect in ['/', '/my']): + return '/my/education/dashboard' + + return redirect_url