diff --git a/addons/Dine360_Shivasakthi/__manifest__.py b/addons/Dine360_Shivasakthi/__manifest__.py
index caed817..a2e0df7 100644
--- a/addons/Dine360_Shivasakthi/__manifest__.py
+++ b/addons/Dine360_Shivasakthi/__manifest__.py
@@ -12,6 +12,7 @@
'dine360_theme_shivasakthi',
'dine360_kds',
'dine360_reservation',
+ 'dine360_table',
'dine360_uber',
'dine360_recipe',
'dine360_self_order',
diff --git a/addons/dine360_dashboard/__manifest__.py b/addons/dine360_dashboard/__manifest__.py
index 010530f..a46f01a 100644
--- a/addons/dine360_dashboard/__manifest__.py
+++ b/addons/dine360_dashboard/__manifest__.py
@@ -4,13 +4,11 @@
'license': 'LGPL-3',
'category': 'Website',
'summary': 'Redirect login to home and show icon grid',
- 'depends': ['base', 'web', 'auth_signup', 'website', 'website_sale'],
+ 'depends': ['base', 'web', 'auth_signup'],
'data': [
'views/home_template.xml',
'views/login_templates.xml',
'views/web_title_template.xml',
- 'views/website_logo.xml',
- 'views/shop_template.xml',
'data/branding_data.xml',
],
'assets': {
@@ -23,8 +21,6 @@
'web.assets_frontend': [
'dine360_dashboard/static/src/css/theme_variables.css',
'dine360_dashboard/static/src/css/login_style.css',
- 'dine360_dashboard/static/src/css/website_style.css',
- 'dine360_dashboard/static/src/css/shop_style.css',
],
'web.assets_common': [
'dine360_dashboard/static/src/css/theme_variables.css',
diff --git a/addons/dine360_dashboard/controllers/main.py b/addons/dine360_dashboard/controllers/main.py
index 3511074..81e3334 100644
--- a/addons/dine360_dashboard/controllers/main.py
+++ b/addons/dine360_dashboard/controllers/main.py
@@ -1,9 +1,10 @@
+# -*- coding: utf-8 -*-
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)
+ @http.route('/web/login', type='http', auth="public")
def web_login(self, *args, **kw):
response = super(CustomHome, self).web_login(*args, **kw)
if request.params.get('login_success') and request.session.uid:
@@ -11,137 +12,109 @@ class CustomHome(Home):
return request.redirect('/')
return response
-from odoo.addons.website.controllers.main import Website
+def render_dashboard(request):
+ # 1. ROLE-BASED AUTO REDIRECTION (FOR STAFF)
+ # Skip the dashboard/website entirely for Chefs and Waiters
+ user = request.env.user.sudo()
+ is_admin = user.has_group('base.group_system') or \
+ user.has_group('dine360_restaurant.group_restaurant_admin')
+
+ if not is_admin:
+ # 1. WAITER / CASHIER -> Priority goes to POS
+ if user.has_group('dine360_restaurant.group_restaurant_waiter') or \
+ user.has_group('dine360_restaurant.group_restaurant_cashier'):
+ return request.redirect('/web#action=point_of_sale.action_client_pos_menu')
-class ImageHome(Website):
- @http.route('/', type='http', auth='public', website=True, sitemap=True)
- def index(self, **kwargs):
- # -----------------------------------------------------------
- # SUPER SAFE EDITOR & IFRAME DETECTION
- # -----------------------------------------------------------
- path = request.httprequest.path
- params = request.params
- headers = request.httprequest.headers
- referer = headers.get('Referer', '')
- fetch_dest = headers.get('Sec-Fetch-Dest', '')
+ # 2. CHEF -> Directly to KDS
+ if user.has_group('dine360_restaurant.group_restaurant_kitchen'):
+ return request.redirect('/web#action=dine360_kds.action_kds_dashboard')
+
+ # Remove sudo() to respect Odoo's standard menu group restrictions
+ menus = request.env['ir.ui.menu'].search([
+ ('parent_id', '=', False)
+ ], order='sequence')
+
+ # User role checks
+ try:
+ is_admin = request.env.user.has_group('base.group_system') or \
+ request.env.user.has_group('dine360_restaurant.group_restaurant_admin')
+ except Exception:
+ is_admin = request.env.user.has_group('base.group_system')
+
+ # User requested to hide all standard apps and POS/KDS.
+ # Only allow specific menus based on user request + admin tools.
+ allowed_menus = ['Online Orders', 'Website', 'Table Reservations', 'Table Management', 'Uber Integration', 'Apps', 'Settings', 'Dine360 SaaS']
+
+ # Hide 'Website' icon from the parent level Dine360Restaurants database
+ if request.env.cr.dbname and 'Dine360Restaurants' in request.env.cr.dbname:
+ if 'Website' in allowed_menus:
+ allowed_menus.remove('Website')
+
+ # Hide website/online orders if website module is not installed in current db
+ if 'website' not in request.env:
+ if 'Website' in allowed_menus:
+ allowed_menus.remove('Website')
+ if 'Online Orders' in allowed_menus:
+ allowed_menus.remove('Online Orders')
+
+ filtered_menus = []
+ seen_names = set()
+ for menu in menus:
+ # Match strictly against allowed menus
+ if menu.name not in allowed_menus and menu.name != 'Table Reservation':
+ continue
+
+ # Hide "Apps" and "Settings" for non-admins
+ if menu.name in ['Apps', 'Settings'] and not is_admin:
+ continue
+
+ # De-duplicate by name
+ if menu.name in seen_names:
+ continue
+ seen_names.add(menu.name)
+
+ # Dynamic Icon Override (Dine360 Branding)
+ icon_mapping = {
+ 'Apps': 'dine360_dashboard,static/src/img/icons/apps.svg',
+ 'Settings': 'dine360_dashboard,static/src/img/icons/settings.svg',
+ 'Table Reservation': 'dine360_dashboard,static/src/img/icons/table_reservation.svg',
+ 'Table Reservations': 'dine360_dashboard,static/src/img/icons/table_reservation.svg',
+ 'Uber Integration': 'dine360_dashboard,static/src/img/icons/uber_integration.svg',
+ 'Online Orders': 'dine360_dashboard,static/src/img/icons/website.svg',
+ 'Dine360 SaaS': 'dine360_dashboard,static/src/img/icons/saas.svg',
+ 'SaaS': 'dine360_dashboard,static/src/img/icons/saas.svg',
+ }
- # 1. If not logged in, always show standard homepage
- if not request.session.uid:
- return super(ImageHome, self).index(**kwargs)
+ # Find the best match in the mapping
+ current_name = menu.name
+ for key, icon_path in icon_mapping.items():
+ if key.lower() in current_name.lower():
+ menu.web_icon = icon_path
+ break
- # 2. ROLE-BASED AUTO REDIRECTION (FOR STAFF)
- # Skip the dashboard/website entirely for Chefs and Waiters
- user = request.env.user.sudo()
- is_admin = user.has_group('base.group_system') or \
- user.has_group('dine360_restaurant.group_restaurant_admin')
-
- if not is_admin:
- # 1. WAITER / CASHIER -> Priority goes to POS
- if user.has_group('dine360_restaurant.group_restaurant_waiter') or \
- user.has_group('dine360_restaurant.group_restaurant_cashier'):
- return request.redirect('/web#action=point_of_sale.action_client_pos_menu')
+ filtered_menus.append(menu)
- # 2. CHEF -> Directly to KDS
- if user.has_group('dine360_restaurant.group_restaurant_kitchen'):
- return request.redirect('/web#action=dine360_kds.action_kds_dashboard')
-
- # 3. SUPER SAFE EDITOR & IFRAME DETECTION
- path = request.httprequest.path
- params = request.params
- headers = request.httprequest.headers
- referer = headers.get('Referer', '')
- fetch_dest = headers.get('Sec-Fetch-Dest', '')
-
- # Check for ANY editor or backend signal
- 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 it looks like Odoo internal business, return the real website
- if fetch_dest == 'iframe' or is_editor_request or is_from_backend:
- return super(ImageHome, self).index(**kwargs)
-
- if path != '/':
- return super(ImageHome, self).index(**kwargs)
-
- # Remove sudo() to respect Odoo's standard menu group restrictions
- menus = request.env['ir.ui.menu'].search([
- ('parent_id', '=', False)
- ], order='sequence')
-
- # User role checks
- try:
- is_admin = request.env.user.has_group('base.group_system') or \
- request.env.user.has_group('dine360_restaurant.group_restaurant_admin')
- is_kitchen = request.env.user.has_group('dine360_restaurant.group_restaurant_kitchen')
- except Exception:
- is_admin = request.env.user.has_group('base.group_system')
- is_kitchen = False
-
- # User requested to hide all standard apps and POS/KDS.
- # Only allow specific menus based on user request + admin tools.
- allowed_menus = ['Online Orders', 'Website', 'Table Reservations', 'Uber Integration', 'Apps', 'Settings', 'Dine360 SaaS']
-
- # Hide 'Website' icon from the parent level Dine360Restaurants database
- if request.env.cr.dbname and 'Dine360Restaurants' in request.env.cr.dbname:
- if 'Website' in allowed_menus:
- allowed_menus.remove('Website')
-
- filtered_menus = []
- seen_names = set()
- for menu in menus:
- # Match strictly against allowed menus
- if menu.name not in allowed_menus and menu.name != 'Table Reservation':
- continue
-
- # Hide "Apps" and "Settings" for non-admins
- if menu.name in ['Apps', 'Settings'] and not is_admin:
- continue
-
- # De-duplicate by name
- if menu.name in seen_names:
- continue
- seen_names.add(menu.name)
-
- # Dynamic Icon Override (Dine360 Branding)
- icon_mapping = {
- 'Apps': 'dine360_dashboard,static/src/img/icons/apps.svg',
- 'Settings': 'dine360_dashboard,static/src/img/icons/settings.svg',
- 'Table Reservation': 'dine360_dashboard,static/src/img/icons/table_reservation.svg',
- 'Table Reservations': 'dine360_dashboard,static/src/img/icons/table_reservation.svg',
- 'Uber Integration': 'dine360_dashboard,static/src/img/icons/uber_integration.svg',
- 'Online Orders': 'dine360_dashboard,static/src/img/icons/website.svg',
- 'Dine360 SaaS': 'dine360_dashboard,static/src/img/icons/saas.svg',
- 'SaaS': 'dine360_dashboard,static/src/img/icons/saas.svg',
- }
-
- # Find the best match in the mapping
- current_name = menu.name
- for key, icon_path in icon_mapping.items():
- if key.lower() in current_name.lower():
- menu.web_icon = icon_path
- break
-
- filtered_menus.append(menu)
-
- # Low Stock Alerts (Ingredients)
+ # Low Stock Alerts (Ingredients)
+ low_stock_products = []
+ try:
+ ProductTemplate = request.env['product.template'].sudo()
+ if hasattr(ProductTemplate, 'get_low_stock_products'):
+ low_stock_products = ProductTemplate.get_low_stock_products(limit=5)
+ except Exception:
low_stock_products = []
- try:
- ProductTemplate = request.env['product.template'].sudo()
- if hasattr(ProductTemplate, 'get_low_stock_products'):
- low_stock_products = ProductTemplate.get_low_stock_products(limit=5)
- except Exception:
- low_stock_products = []
- return request.render('dine360_dashboard.image_home_template', {
- 'menus': filtered_menus,
- 'user_id': request.env.user,
- 'low_stock_products': low_stock_products
- })
+ values = {
+ 'menus': filtered_menus,
+ 'user_id': request.env.user,
+ 'low_stock_products': low_stock_products
+ }
+ if 'website' in request.env:
+ values['website'] = request.env['website'].get_current_website()
+ return request.render('dine360_dashboard.image_home_template', values)
-
- @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')
+class ImageHomeBase(http.Controller):
+ @http.route('/', type='http', auth='user', website=True)
+ def index(self, **kwargs):
+ # Render the dashboard for logged in users when website module is not installed
+ return render_dashboard(request)
diff --git a/addons/dine360_dashboard_website/__init__.py b/addons/dine360_dashboard_website/__init__.py
new file mode 100644
index 0000000..153a9e3
--- /dev/null
+++ b/addons/dine360_dashboard_website/__init__.py
@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+from . import controllers
diff --git a/addons/dine360_dashboard_website/__manifest__.py b/addons/dine360_dashboard_website/__manifest__.py
new file mode 100644
index 0000000..f34d296
--- /dev/null
+++ b/addons/dine360_dashboard_website/__manifest__.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+{
+ 'name': 'Dine360 Dashboard Website Glue',
+ 'version': '1.0.0',
+ 'category': 'Website',
+ 'summary': 'Glue module for Dine360 Dashboard Website features',
+ 'depends': ['dine360_dashboard', 'website', 'website_sale'],
+ 'data': [
+ 'views/website_logo.xml',
+ 'views/shop_template.xml',
+ ],
+ 'assets': {
+ 'web.assets_frontend': [
+ 'dine360_dashboard/static/src/css/website_style.css',
+ 'dine360_dashboard/static/src/css/shop_style.css',
+ ],
+ },
+ 'auto_install': True,
+ 'installable': True,
+ 'license': 'LGPL-3',
+}
diff --git a/addons/dine360_dashboard_website/controllers/__init__.py b/addons/dine360_dashboard_website/controllers/__init__.py
new file mode 100644
index 0000000..757b12a
--- /dev/null
+++ b/addons/dine360_dashboard_website/controllers/__init__.py
@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+from . import main
diff --git a/addons/dine360_dashboard_website/controllers/main.py b/addons/dine360_dashboard_website/controllers/main.py
new file mode 100644
index 0000000..ca9d8a0
--- /dev/null
+++ b/addons/dine360_dashboard_website/controllers/main.py
@@ -0,0 +1,45 @@
+# -*- 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')
diff --git a/addons/dine360_dashboard_website/views/shop_template.xml b/addons/dine360_dashboard_website/views/shop_template.xml
new file mode 100644
index 0000000..e207bd6
--- /dev/null
+++ b/addons/dine360_dashboard_website/views/shop_template.xml
@@ -0,0 +1,10 @@
+
+
${response.message}
-