Alaguraj0361 c82f392e15 Add Dine360 Dashboard Website module with custom controllers and views
- Created __init__.py and __manifest__.py for the new dine360_dashboard_website module.
- Implemented custom controllers to handle website routing and dashboard rendering.
- Added views for website logo and shop template to enhance the user interface.
- Updated dine360_reservation and dine360_restaurant modules to include dine360_table as a dependency.
- Enhanced restaurant table management with new views and actions for floors and tables.
- Updated docker-compose to change the exposed port for the Odoo service.
2026-06-23 20:38:41 +05:30

46 lines
1.9 KiB
Python

# -*- coding: utf-8 -*-
from odoo import http
from odoo.http import request
from odoo.addons.web.controllers.home import Home
from odoo.addons.website.controllers.main import Website
from odoo.addons.dine360_dashboard.controllers.main import render_dashboard
class CustomHomeWebsite(Home):
@http.route('/web/login', type='http', auth="public", website=True)
def web_login(self, *args, **kw):
response = super(CustomHomeWebsite, self).web_login(*args, **kw)
if request.params.get('login_success') and request.session.uid:
return request.redirect('/')
return response
class ImageHomeWebsite(Website):
@http.route('/', type='http', auth='public', website=True, sitemap=True)
def index(self, **kwargs):
# 1. If not logged in, show website homepage
if not request.session.uid:
return super(ImageHomeWebsite, self).index(**kwargs)
# 2. If logged in, check for editor / iframe detection
params = request.params
headers = request.httprequest.headers
referer = headers.get('Referer', '')
fetch_dest = headers.get('Sec-Fetch-Dest', '')
editor_params = ['enable_editor', 'edit', 'path', 'website_id', 'frontend_edit', 'model', 'id']
is_editor_request = any(p in params for p in editor_params)
is_from_backend = any(m in referer for m in ['/website/force', 'enable_editor'])
if fetch_dest == 'iframe' or is_editor_request or is_from_backend:
return super(ImageHomeWebsite, self).index(**kwargs)
if request.httprequest.path != '/':
return super(ImageHomeWebsite, self).index(**kwargs)
# Render the dashboard
return render_dashboard(request)
@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')