from odoo import http
from odoo.http import request
from odoo.addons.web.controllers.home import Home

class CustomHome(Home):
    @http.route('/web/login', type='http', auth="public", website=True)
    def web_login(self, *args, **kw):
        response = super(CustomHome, self).web_login(*args, **kw)
        if request.params.get('login_success') and request.session.uid:
            return request.redirect('/')
        return response

from odoo.addons.website.controllers.main import Website

class ImageHome(Website):
    @http.route('/', type='http', auth='user', website=True, sitemap=True)
    def index(self, **kwargs):
        # Override root to show Dashboard
        menus = request.env['ir.ui.menu'].sudo().search([
            ('parent_id', '=', False)
        ], order='sequence')
        
        return request.render('dine360_dashboard.image_home_template', {
            'menus': menus,
            'user_id': request.env.user
        })

    @http.route('/home', type='http', auth="public", website=True, sitemap=True)
    def website_home(self, **kw):
        # Explicit route for standard Website Homepage
        return request.render('website.homepage')
