From 8191f7d58cb34356c9a77e9c9a722cc57e840473 Mon Sep 17 00:00:00 2001 From: Alaguraj0361 Date: Tue, 24 Feb 2026 11:01:11 +0530 Subject: [PATCH] Implement custom homepage dashboard, header styling, and role-based menu access with login redirection and title customization. --- .../__pycache__/main.cpython-310.pyc | Bin 1665 -> 2090 bytes addons/dine360_dashboard/controllers/main.py | 30 ++++++++++++++++-- .../static/src/css/website_style.css | 4 +-- .../dine360_dashboard/views/home_template.xml | 11 +++++-- .../views/web_title_template.xml | 20 ++++++------ .../views/restaurant_menus.xml | 3 +- 6 files changed, 50 insertions(+), 18 deletions(-) diff --git a/addons/dine360_dashboard/controllers/__pycache__/main.cpython-310.pyc b/addons/dine360_dashboard/controllers/__pycache__/main.cpython-310.pyc index 9b6a727973d2d5813a22c58b1215c2abe6abb831..26b8ec42a6191abf9ec8281e3d6543d472701029 100644 GIT binary patch delta 674 zcma)2L5mYH7@Z`ObUNFPySNucK`%ntbtx{aum@M!f`{Uzy$B-1Y!lmQZ8}Y+?OLW3 z*|Vp)Do(GS6#N_hfgC*gGt@7$x?TS-r)bq9_+)26jDHh0u> z;H)S|HV8QxE$SImK+d$8ItAhNj9!-E!F#;HU8iv^|3O;oowG=bgT9)~l2E_VsTeOC zJeK0{s2M7u(`cq5nf@90XM_rM98^eT12WhFz!r)RUJe+EL$6*MQU6bjfL?R;w+4N6KQ;C zu2Q{-(}5uo=Y~Z|0%;9TT`!|Yi%9jg+OxuoHN0mH4>CT`zkP#O@#|D5!NakTGYy$S z$k1M-jcYA+!&WWfrp=)-)IGQT^#cG8`^YC4;a?cDpSNg$T+EP%?qG~|iHC4`T0=F= gz+t&@yXby?K=;wZ`~^K>k8Ju$UVw2g|3<(52KV*GGynhq delta 254 zcmZ1_(8$Y|&&$ij00hrI&(5@F-N@I>%*PDmvH`I-5Ena5p3f|+wSaXYLl#>Kb2?)R zOA2c*Q!P^o!vf|Mwi+Ov#gfII!aj#-AyY7eCdcF^7MICBtd{j0MIdvE1VDr!khsNG zl$w{4T6Bv!HLvUzOL1vR{w=oR)Wo9Xj9VP_%tgXrb=l>KMd`&w8X%pLa6$?s z$C?Q=q5@=Qu^5oxVB%urV`gGx`p?9~_K%H)iII(w<6jlOXKv!;ZZ>a5t;yHfbQt9) Xv#{H<8GuYOob1W2!^k(ejC~6LHJ3aX diff --git a/addons/dine360_dashboard/controllers/main.py b/addons/dine360_dashboard/controllers/main.py index 3190d80..09a55fc 100644 --- a/addons/dine360_dashboard/controllers/main.py +++ b/addons/dine360_dashboard/controllers/main.py @@ -18,16 +18,40 @@ class ImageHome(Website): if not request.session.uid: return request.render('website.homepage') - # Override root to show Dashboard for logged in users - menus = request.env['ir.ui.menu'].sudo().search([ + # 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 + 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') + + filtered_menus = [] + seen_names = set() + for menu in menus: + # 1. Hide "Apps" for non-admins (usually name is 'Apps' or xmlid has base.menu_management) + if (menu.name == 'Apps' or (menu.web_icon and menu.web_icon.startswith('base,'))) and not is_admin: + continue + + # 2. Hide "Kitchen (KDS)" for Waiters (only show for Kitchen Staff or Admin) + if 'Kitchen' in menu.name or 'KDS' in menu.name: + if not (is_kitchen or is_admin): + continue + + # 3. De-duplicate by name to prevent double icons (like Kitchen showing twice) + if menu.name in seen_names: + continue + seen_names.add(menu.name) + + filtered_menus.append(menu) + return request.render('dine360_dashboard.image_home_template', { - 'menus': menus, + 'menus': filtered_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 diff --git a/addons/dine360_dashboard/static/src/css/website_style.css b/addons/dine360_dashboard/static/src/css/website_style.css index c1def45..4f8dd6e 100644 --- a/addons/dine360_dashboard/static/src/css/website_style.css +++ b/addons/dine360_dashboard/static/src/css/website_style.css @@ -6,8 +6,8 @@ body .o_header_standard, body header.o_header_standard, body .navbar, body #o_main_nav { - background-color: #171422 !important; - background: #171422 !important; + background-color: #111 !important; + /* background: #171422 !important; */ border-bottom: none; } diff --git a/addons/dine360_dashboard/views/home_template.xml b/addons/dine360_dashboard/views/home_template.xml index 0b20dee..9596672 100644 --- a/addons/dine360_dashboard/views/home_template.xml +++ b/addons/dine360_dashboard/views/home_template.xml @@ -32,12 +32,17 @@ - - - + + + + + + +
+
diff --git a/addons/dine360_dashboard/views/web_title_template.xml b/addons/dine360_dashboard/views/web_title_template.xml index a7e157c..29f6a66 100644 --- a/addons/dine360_dashboard/views/web_title_template.xml +++ b/addons/dine360_dashboard/views/web_title_template.xml @@ -4,15 +4,17 @@ Chennora - - - Back to Dashboard - + + + + Back to Dashboard + + diff --git a/addons/dine360_restaurant/views/restaurant_menus.xml b/addons/dine360_restaurant/views/restaurant_menus.xml index 1259821..db84ff2 100644 --- a/addons/dine360_restaurant/views/restaurant_menus.xml +++ b/addons/dine360_restaurant/views/restaurant_menus.xml @@ -8,7 +8,7 @@ - +