Introduce Dine360 Chennora theme with custom homepage, product features, and dashboard routing for logged-in users.

This commit is contained in:
Alaguraj0361 2026-02-23 19:18:04 +05:30
parent 485b6b1b61
commit d48cb84a10
9 changed files with 80 additions and 169 deletions

View File

@ -13,9 +13,12 @@ class CustomHome(Home):
from odoo.addons.website.controllers.main import Website from odoo.addons.website.controllers.main import Website
class ImageHome(Website): class ImageHome(Website):
@http.route('/', type='http', auth='user', website=True, sitemap=True) @http.route('/', type='http', auth='public', website=True, sitemap=True)
def index(self, **kwargs): def index(self, **kwargs):
# Override root to show Dashboard 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([ menus = request.env['ir.ui.menu'].sudo().search([
('parent_id', '=', False) ('parent_id', '=', False)
], order='sequence') ], order='sequence')

View File

@ -1 +1,2 @@
from . import controllers from . import controllers
from . import models

View File

@ -13,6 +13,7 @@
'views/faq_page.xml', # FAQ Page 'views/faq_page.xml', # FAQ Page
'views/shop_page.xml', # Shop Page 'views/shop_page.xml', # Shop Page
'views/product_details_page.xml', # Customized Product Details Page 'views/product_details_page.xml', # Customized Product Details Page
'views/product_views.xml', # Product Form custom fields
'views/snippets.xml', # Custom Building Blocks 'views/snippets.xml', # Custom Building Blocks
'views/options.xml', # Options for snippets (if any) 'views/options.xml', # Options for snippets (if any)
'data/website_data.xml', # Data for creating pages 'data/website_data.xml', # Data for creating pages

View File

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import product_template

View File

@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
from odoo import models, fields
class ProductTemplate(models.Model):
_inherit = 'product.template'
is_popular_deal = fields.Boolean(string='Is Popular Deal', default=False, help='Check this to show this product in Popular Deals section on Homepage')

View File

@ -7,7 +7,8 @@
<!-- ====================================================== --> <!-- ====================================================== -->
<template id="custom_homepage" inherit_id="website.homepage" name="Chennora Homepage" priority="1000"> <template id="custom_homepage" inherit_id="website.homepage" name="Chennora Homepage" priority="1000">
<xpath expr="//div[@id='wrap']" position="replace"> <xpath expr="//div[@id='wrap']" position="replace">
<div id="wrap" class="oe_structure"> <t t-set="pop_products" t-value="request.env['product.template'].sudo().search([('is_published', '=', True), ('sale_ok', '=', True), ('is_popular_deal', '=', True), ('website_id', 'in', [False, website.id])], limit=10, order='website_sequence asc')"/>
<div id="wrap" class="oe_structure">
<section class="s_carousel_wrapper" data-vxml="001" data-snippet="s_carousel" data-name="Carousel"> <section class="s_carousel_wrapper" data-vxml="001" data-snippet="s_carousel" data-name="Carousel">
<div class="s_carousel carousel s_carousel_rounded slide" data-bs-interval="10000" id="myCarouselChennora" data-bs-ride="carousel"> <div class="s_carousel carousel s_carousel_rounded slide" data-bs-interval="10000" id="myCarouselChennora" data-bs-ride="carousel">
@ -273,75 +274,20 @@
<!-- Category Slider Section --> <!-- Category Slider Section -->
<section class="s_category_slider o_colored_level" data-snippet="s_category_slider" data-name="Category Slider" style="background-color: rgb(244, 241, 234);"> <section class="s_category_slider o_colored_level" data-snippet="s_category_slider" data-name="Category Slider" style="background-color: rgb(244, 241, 234);">
<t t-set="shop_categories" t-value="request.env['product.public.category'].sudo().search([('website_id', 'in', [False, website.id]), ('parent_id', '=', False)], order='sequence asc')"/>
<div class="container-fluid overflow-hidden"> <div class="container-fluid overflow-hidden">
<div class="category-track d-flex flex-nowrap"> <div class="category-track d-flex flex-nowrap">
<t t-foreach="shop_categories" t-as="categ">
<!-- Item 1: House Biryani --> <div class="col-lg-2 col-md-4 col-6 category-item text-center flex-shrink-0">
<div class="col-lg-2 col-md-4 col-6 category-item text-center flex-shrink-0"> <a t-attf-href="/shop?category=#{categ.id}" class="d-block text-decoration-none p-2">
<a href="/shop" class="d-block text-decoration-none p-2"> <div class="bg-white rounded p-1 shadow-sm mb-3 category-img" style="border: 2px solid transparent; border-radius: 20px !important; overflow: hidden;">
<div class="bg-white rounded p-1 shadow-sm mb-3 category-img" style="border: 2px solid transparent; border-radius: 20px !important; overflow: hidden;"> <img t-att-src="website.image_url(categ, 'image_1920')" class="img img-fluid" style="width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 15px;" t-att-alt="categ.name" loading="lazy"/>
<img src="/dine360_theme_chennora/static/src/img/cat-biryani.png" class="img img-fluid" style="width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 15px;" alt="House Biryani"/> </div>
</div> <h6 class="fw-bold mb-1 text-dark" style="font-size: 16px;" t-field="categ.name"/>
<h6 class="fw-bold mb-1 text-dark" style="font-size: 16px;">House Biryani</h6> <small class="text-muted"><t t-esc="categ.product_tmpl_ids and len(categ.product_tmpl_ids) or 0"/>+ Varieties</small>
<small class="text-muted">5+ Varieties</small> </a>
</a> </div>
</div> </t>
<!-- Item 2: Cold Beverages -->
<div class="col-lg-2 col-md-4 col-6 category-item text-center flex-shrink-0">
<a href="/shop" class="d-block text-decoration-none p-2">
<div class="bg-white rounded p-1 shadow-sm mb-3 category-img" style="border: 2px solid transparent; border-radius: 20px !important; overflow: hidden;">
<img src="/dine360_theme_chennora/static/src/img/cat-beverages.png" class="img img-fluid" style="width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 15px;" alt="Cold Beverages"/>
</div>
<h6 class="fw-bold mb-1 text-dark" style="font-size: 16px;">Cold Beverages</h6>
<small class="text-muted">3+ Varieties</small>
</a>
</div>
<!-- Item 3: Curries -->
<div class="col-lg-2 col-md-4 col-6 category-item text-center flex-shrink-0">
<a href="/shop" class="d-block text-decoration-none p-2">
<div class="bg-white rounded p-1 shadow-sm mb-3 category-img" style="border: 2px solid transparent; border-radius: 20px !important; overflow: hidden;">
<img src="/dine360_theme_chennora/static/src/img/cat-curries.png" class="img img-fluid" style="width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 15px;" alt="Curries"/>
</div>
<h6 class="fw-bold mb-1 text-dark" style="font-size: 16px;">Curries</h6>
<small class="text-muted">5+ Varieties</small>
</a>
</div>
<!-- Item 4: Desserts -->
<div class="col-lg-2 col-md-4 col-6 category-item text-center flex-shrink-0">
<a href="/shop" class="d-block text-decoration-none p-2">
<div class="bg-white rounded p-1 shadow-sm mb-3 category-img" style="border: 2px solid transparent; border-radius: 20px !important; overflow: hidden;">
<img src="/dine360_theme_chennora/static/src/img/cat-desserts.png" class="img img-fluid" style="width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 15px;" alt="Desserts"/>
</div>
<h6 class="fw-bold mb-1 text-dark" style="font-size: 16px;">Desserts</h6>
<small class="text-muted">5+ Varieties</small>
</a>
</div>
<!-- Item 5: Dosa Varieties -->
<div class="col-lg-2 col-md-4 col-6 category-item text-center flex-shrink-0">
<a href="/shop" class="d-block text-decoration-none p-2">
<div class="bg-white rounded p-1 shadow-sm mb-3 category-img" style="border: 2px solid transparent; border-radius: 20px !important; overflow: hidden;">
<img src="/dine360_theme_chennora/static/src/img/cat-dosa.png" class="img img-fluid" style="width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 15px;" alt="Dosa Varieties"/>
</div>
<h6 class="fw-bold mb-1 text-dark" style="font-size: 16px;">Dosa Varieties</h6>
<small class="text-muted">10+ Varieties</small>
</a>
</div>
<!-- Item 6: Repeat Curries for filler -->
<div class="col-lg-2 col-md-4 col-6 category-item text-center flex-shrink-0">
<a href="/shop" class="d-block text-decoration-none p-2">
<div class="bg-white rounded p-1 shadow-sm mb-3 category-img" style="border: 2px solid transparent; border-radius: 20px !important; overflow: hidden;">
<img src="/dine360_theme_chennora/static/src/img/cat-curries.png" class="img img-fluid" style="width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 15px;" alt="Curries"/>
</div>
<h6 class="fw-bold mb-1 text-dark" style="font-size: 16px;">Curries &amp; More</h6>
<small class="text-muted">Check Menu</small>
</a>
</div>
</div> </div>
</div> </div>
</section> </section>
@ -368,117 +314,50 @@
<div class="row align-items-center"> <div class="row align-items-center">
<!-- Left Deals --> <!-- Left Deals -->
<div class="col-lg-4"> <div class="col-lg-4">
<div class="deal-item active" data-deal-img="/dine360_theme_chennora/static/src/img/cat-biryani.png"> <t t-foreach="pop_products[:5]" t-as="product">
<div class="deal-img-wrapper"> <div t-attf-class="deal-item #{'active' if product_index == 0 else ''}" t-att-data-deal-img="website.image_url(product, 'image_1024')">
<img src="/dine360_theme_chennora/static/src/img/cat-biryani.png" alt="Veg Biryani"/> <div class="deal-img-wrapper">
<img t-att-src="website.image_url(product, 'image_128')" t-att-alt="product.name" loading="lazy"/>
</div>
<div class="deal-details">
<h6 t-field="product.name"/>
<p t-field="product.description_sale"/>
</div>
<div t-attf-class="deal-price">
<span t-field="product.list_price" t-options='{"widget": "monetary"}'/>
</div>
</div> </div>
<div class="deal-details"> </t>
<h6>Veg Biryani</h6>
<p>It's a testament to our.</p>
</div>
<div class="deal-price">$14.99</div>
</div>
<div class="deal-item" data-deal-img="/dine360_theme_chennora/static/src/img/deal-dosa.png">
<div class="deal-img-wrapper">
<img src="/dine360_theme_chennora/static/src/img/deal-dosa.png" alt="Masala Dosa"/>
</div>
<div class="deal-details">
<h6>Masala Dosa</h6>
<p>It's a testament to our.</p>
</div>
<div class="deal-price">$12.99</div>
</div>
<div class="deal-item" data-deal-img="/dine360_theme_chennora/static/src/img/deal-kothu.png">
<div class="deal-img-wrapper">
<img src="/dine360_theme_chennora/static/src/img/deal-kothu.png" alt="Chicken Kothu"/>
</div>
<div class="deal-details">
<h6>Chicken Kothu</h6>
<p>It's a testament to our.</p>
</div>
<div class="deal-price">$15.99</div>
</div>
<div class="deal-item" data-deal-img="/dine360_theme_chennora/static/src/img/deal-nuggets.png">
<div class="deal-img-wrapper">
<img src="/dine360_theme_chennora/static/src/img/deal-nuggets.png" alt="Chicken Nuggets"/>
</div>
<div class="deal-details">
<h6>Chicken Nuggets</h6>
<p>It's a testament to our.</p>
</div>
<div class="deal-price">$8.99</div>
</div>
<div class="deal-item" data-deal-img="/dine360_theme_chennora/static/src/img/deal-coffee.png">
<div class="deal-img-wrapper">
<img src="/dine360_theme_chennora/static/src/img/deal-coffee.png" alt="Filter Coffee"/>
</div>
<div class="deal-details">
<h6>Filter Coffee</h6>
<p>It's a testament to our.</p>
</div>
<div class="deal-price">$3.99</div>
</div>
</div> </div>
<!-- Center Large Image --> <!-- Center Large Image -->
<div class="col-lg-4 text-center"> <div class="col-lg-4 text-center">
<div class="deal-center-image"> <div class="deal-center-image">
<img src="/dine360_theme_chennora/static/src/img/cat-biryani.png" id="dealCenterImg" class="img img-fluid" alt="Main Popular Dish" style="transition: opacity 0.3s ease-in-out;"/> <t t-if="pop_products">
<img t-att-src="website.image_url(pop_products[0], 'image_1024')" id="dealCenterImg" class="img img-fluid" alt="Main Popular Dish" style="transition: opacity 0.3s ease-in-out;"/>
</t>
<t t-else="">
<img src="/dine360_theme_chennora/static/src/img/cat-biryani.png" id="dealCenterImg" class="img img-fluid" alt="Main Popular Dish" style="transition: opacity 0.3s ease-in-out;"/>
</t>
</div> </div>
</div> </div>
<!-- Right Deals --> <!-- Right Deals -->
<div class="col-lg-4"> <div class="col-lg-4">
<div class="deal-item" data-deal-img="/dine360_theme_chennora/static/src/img/crispy-gobi-65.png"> <t t-foreach="pop_products[5:10]" t-as="product">
<div class="deal-img-wrapper"> <div class="deal-item" t-att-data-deal-img="website.image_url(product, 'image_1024')">
<img src="/dine360_theme_chennora/static/src/img/crispy-gobi-65.png" alt="Paneer 65"/> <div class="deal-img-wrapper">
<img t-att-src="website.image_url(product, 'image_128')" t-att-alt="product.name" loading="lazy"/>
</div>
<div class="deal-details">
<h6 t-field="product.name"/>
<p t-field="product.description_sale"/>
</div>
<div t-attf-class="deal-price">
<span t-field="product.list_price" t-options='{"widget": "monetary"}'/>
</div>
</div> </div>
<div class="deal-details"> </t>
<h6>Paneer 65</h6>
<p>It's a testament to our.</p>
</div>
<div class="deal-price">$10.99</div>
</div>
<div class="deal-item" data-deal-img="/dine360_theme_chennora/static/src/img/cat-dosa.png">
<div class="deal-img-wrapper">
<img src="/dine360_theme_chennora/static/src/img/cat-dosa.png" alt="Kids Cone Dosa"/>
</div>
<div class="deal-details">
<h6>Kids Cone Dosa</h6>
<p>It's a testament to our.</p>
</div>
<div class="deal-price">$8.99</div>
</div>
<div class="deal-item" data-deal-img="/dine360_theme_chennora/static/src/img/unlimited-thali.png">
<div class="deal-img-wrapper">
<img src="/dine360_theme_chennora/static/src/img/unlimited-thali.png" alt="Sambar Idli"/>
</div>
<div class="deal-details">
<h6>Sambar Idli</h6>
<p>It's a testament to our.</p>
</div>
<div class="deal-price">$9.99</div>
</div>
<div class="deal-item" data-deal-img="/dine360_theme_chennora/static/src/img/cat-curries.png">
<div class="deal-img-wrapper">
<img src="/dine360_theme_chennora/static/src/img/cat-curries.png" alt="Veg Thali"/>
</div>
<div class="deal-details">
<h6>Veg Thali</h6>
<p>It's a testament to our.</p>
</div>
<div class="deal-price">$14.99</div>
</div>
<div class="deal-item" data-deal-img="/dine360_theme_chennora/static/src/img/cat-beverages.png">
<div class="deal-img-wrapper">
<img src="/dine360_theme_chennora/static/src/img/cat-beverages.png" alt="Sweet Corn Soup"/>
</div>
<div class="deal-details">
<h6>Sweet Corn Soup</h6>
<p>It's a testament to our.</p>
</div>
<div class="deal-price">$7.99</div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="product_template_form_view_inherit_deals" model="ir.ui.view">
<field name="name">product.template.form.inherit.deals</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='options']" position="inside">
<span class="d-inline-block">
<field name="is_popular_deal"/>
<label for="is_popular_deal"/>
</span>
</xpath>
</field>
</record>
</data>
</odoo>