Implement Chennora theme module with a custom homepage layout and add view inspection scripts.

This commit is contained in:
Alaguraj0361 2026-01-29 16:23:22 +05:30
parent 1287a329bb
commit 9bbcbf9767
16 changed files with 390 additions and 53 deletions

47
addons/debug_view.py Normal file
View File

@ -0,0 +1,47 @@
print("--- STARTING FIX SCRIPT ---")
try:
# In odoo shell, 'env' is available.
# Find active website (or first one)
websites = env['website'].search([])
for w in websites:
print(f"Checking website: {w.name} (ID: {w.id})")
# Check for COW view for this website
homepage_key = 'website.homepage'
cow_views = env['ir.ui.view'].search([
('key', '=', homepage_key),
('website_id', '=', w.id)
])
if cow_views:
print(f"Found {len(cow_views)} custom homepage views (COW) for {w.name}. Archiving them...")
for view in cow_views:
print(f" - Archiving view {view.name} (ID: {view.id})")
view.write({'active': False})
else:
print(f"No custom homepage views found for {w.name}.")
# Check theme view logic
# The theme view should replace website.homepage
theme_view = env.ref('theme_chennora.custom_homepage', raise_if_not_found=False)
if theme_view:
print(f"Theme view found: {theme_view.name} (ID: {theme_view.id}, Priority: {theme_view.priority})")
# Ensure it's active
if not theme_view.active:
theme_view.write({'active': True})
print(" - Activated theme view")
# Ensure priority is high enough to beat default but usually COW is the issue
if theme_view.priority < 50:
theme_view.write({'priority': 50})
print(" - Updated priority to 50")
else:
print("WARNING: Theme view 'theme_chennora.custom_homepage' not found! Make sure the module is upgraded.")
env.cr.commit()
print("--- FIX COMPLETE ---")
except Exception as e:
print(f"ERROR: {e}")
import traceback
traceback.print_exc()

View File

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

View File

@ -4,7 +4,7 @@
'category': 'Theme/Website',
'version': '1.0',
'author': 'Your Company',
'depends': ['website', 'website_sale'],
'depends': ['website', 'website_sale', 'website_crm'],
'data': [
'views/layout.xml', # Header, Footer, and Global Layout changes
'views/pages.xml', # specific page content (Home, About, etc.)

View File

@ -0,0 +1,3 @@
v = env['ir.ui.view'].browse(3221)
with open('/mnt/extra-addons/theme_chennora/view_3221.xml', 'w') as f:
f.write(str(v.arch_db))

View File

@ -5,12 +5,12 @@
<xpath expr="//html" position="before">
<!-- [ORIGINAL CONTENT PRESERVED] -->
<t t-set="html_data" t-value="{ 'lang': lang and lang.replace('_', '-'), 'data-website-id': website.id if website else None, 'data-edit_translations': '1' if edit_translations else None, 'data-main-object': repr(main_object) if main_object else None, 'data-seo-object': repr(seo_object) if seo_object else None, }"/>
<t t-if="not request.env.user._is_public()" t-set="nothing" t-value="html_data.update({ 'data-is-published': 'website_published' in main_object.fields_get() and main_object.website_published, 'data-can-optimize-seo': 'website_meta_description' in main_object.fields_get(), 'data-can-publish': 'can_publish' in main_object.fields_get() and main_object.can_publish, 'data-editable-in-backend': edit_in_backend or ('website_published' in main_object.fields_get() and main_object._name != 'website.page'), })"/>
<t t-if="not request.env.user._is_public() and main_object" t-set="nothing" t-value="html_data.update({ 'data-is-published': 'website_published' in main_object.fields_get() and main_object.website_published, 'data-can-optimize-seo': 'website_meta_description' in main_object.fields_get(), 'data-can-publish': 'can_publish' in main_object.fields_get() and main_object.can_publish, 'data-editable-in-backend': edit_in_backend or ('website_published' in main_object.fields_get() and main_object._name != 'website.page'), })"/>
<!--
TODO Review in master (this is a stable fix for new databases).
See REVIEW_CAN_PUBLISH_UNSUDO.
-->
<t t-if="html_data and html_data.get('data-can-publish') == True">
<t t-if="html_data and html_data.get('data-can-publish') == True and main_object">
<t t-set="nothing" t-value="html_data.update({ 'data-can-publish': 'can_publish' in main_object.fields_get() and main_object.sudo(flag=False).can_publish, })"/>
</t>
<t t-if="editable or translatable" t-set="nothing" t-value="html_data.update({ 'data-editable': '1' if editable else None, 'data-translatable': '1' if translatable else None, 'data-view-xmlid': xmlid, 'data-viewid': viewid, })"/>
@ -178,16 +178,16 @@
<t t-foreach="['header_overlay', 'header_color', 'header_text_color', 'header_visible', 'footer_visible']" t-as="optionName">
<!-- Firefox autocomplete is too aggressive and works on hidden inputs,
so we need to disable it (https://bugzilla.mozilla.org/show_bug.cgi?id=520561) -->
<input t-if="optionName in main_object" type="hidden" class="o_page_option_data" autocomplete="off" t-att-name="optionName" t-att-value="main_object[optionName]"/>
<input t-if="main_object and optionName in main_object" type="hidden" class="o_page_option_data" autocomplete="off" t-att-name="optionName" t-att-value="main_object[optionName]"/>
</t>
</t>
<t t-set="header_bg_color" t-value="'header_color' in main_object and main_object.header_color or ''"/>
<t t-set="header_bg_color" t-value="main_object and 'header_color' in main_object and main_object.header_color or ''"/>
<t t-set="header_bg_color_is_class" t-value="'bg-' in header_bg_color"/>
<t t-set="header_bg_color_class" t-value="header_bg_color_is_class and header_bg_color or ''"/>
<t t-set="header_bg_color_style" t-value="(not header_bg_color_is_class) and header_bg_color or ''"/>
<t t-set="header_text_color" t-value="'header_text_color' in main_object and main_object.header_text_color or ''"/>
<t t-set="header_text_color" t-value="main_object and 'header_text_color' in main_object and main_object.header_text_color or ''"/>
<t t-set="header_text_color_is_class" t-value="'text-' in header_text_color"/>
<t t-set="header_text_color_class" t-value="header_text_color_is_class and header_text_color or ''"/>
<t t-set="header_text_color_style" t-value="(not header_text_color_is_class) and header_text_color or ''"/>
@ -208,7 +208,7 @@
</div>
</xpath>
<xpath expr="//div[@id='wrapwrap']" position="attributes">
<attribute name="t-attf-class" add="#{'o_header_overlay' if 'header_overlay' in main_object and main_object.header_overlay else ''}" separator=" "/>
<attribute name="t-attf-class" add="#{'o_header_overlay' if main_object and 'header_overlay' in main_object and main_object.header_overlay else ''}" separator=" "/>
</xpath>
<xpath expr="//header" position="attributes">
<attribute name="t-attf-class" add="#{header_bg_color_class}" separator=" "/>
@ -217,12 +217,12 @@
<attribute name="t-attf-style" add="#{header_text_color_style and ('color: %s;' % header_text_color_style)}" separator=" "/>
</xpath>
<xpath expr="//header" position="attributes">
<attribute name="t-attf-class" add="#{'d-none o_snippet_invisible' if 'header_visible' in main_object and not main_object.header_visible else ''}" separator=" "/>
<attribute name="t-att-data-invisible">'1' if 'header_visible' in main_object and not main_object.header_visible else None</attribute>
<attribute name="t-attf-class" add="#{'d-none o_snippet_invisible' if main_object and 'header_visible' in main_object and not main_object.header_visible else ''}" separator=" "/>
<attribute name="t-att-data-invisible">'1' if main_object and 'header_visible' in main_object and not main_object.header_visible else None</attribute>
</xpath>
<xpath expr="//footer[@id='bottom']" position="attributes">
<attribute name="t-attf-class" add="#{'d-none o_snippet_invisible' if 'footer_visible' in main_object and not main_object.footer_visible else ''}" separator=" "/>
<attribute name="t-att-data-invisible">'1' if 'footer_visible' in main_object and not main_object.footer_visible else None</attribute>
<attribute name="t-attf-class" add="#{'d-none o_snippet_invisible' if main_object and 'footer_visible' in main_object and not main_object.footer_visible else ''}" separator=" "/>
<attribute name="t-att-data-invisible">'1' if main_object and 'footer_visible' in main_object and not main_object.footer_visible else None</attribute>
</xpath>
</template>
</data>

View File

@ -5,9 +5,9 @@
<!-- ====================================================== -->
<!-- 1. HOME PAGE (Inherits and Replaces Default Home) -->
<!-- ====================================================== -->
<template id="custom_homepage" inherit_id="website.homepage" name="Chennora Homepage">
<template id="custom_homepage" inherit_id="website.homepage" name="Chennora Homepage" priority="1000">
<xpath expr="//div[@id='wrap']" position="replace">
<div id="wrap" class="oe_structure oe_empty"><section class="s_carousel_wrapper o_half_screen_height" data-vxml="001" data-snippet="s_carousel" data-name="Carousel">
<div id="wrap" class="oe_structure"><section class="s_carousel_wrapper o_half_screen_height" data-vxml="001" data-snippet="s_carousel" data-name="Carousel">
<div class="s_carousel carousel s_carousel_rounded slide" data-bs-interval="10000" id="myCarousel1769233718425" style="background-image: none;">
<ol class="carousel-indicators o_we_no_overlay">
@ -417,71 +417,76 @@ Chennora is rated among the best Indian restaurants in Brampton, offering authen
<h2 class="text-center mb-5">Send us a Message</h2>
<div class="row">
<div class="col-lg-8 offset-lg-2">
<div id="contactus_form_container" class="bg-white p-5 shadow-sm" style="border-radius: 15px;">
<form action="/website/form/" method="post" enctype="multipart/form-data" class="o_mark_required" data-mark="*" data-model_name="mail.mail" data-success-mode="redirect" data-success-page="/contactus-thank-you">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<div class="s_website_form_rows row g-4">
<!-- Name -->
<div class="col-12 s_website_form_field s_website_form_custom s_website_form_required" data-type="char" data-name="Field">
<div id="contactus_form_container" class="bg-white p-4 shadow-sm" style="border-radius: 15px;">
<form id="contactus_form" action="/website/form/" method="post" enctype="multipart/form-data" class="o_mark_required" data-mark="*" data-model_name="crm.lead" data-success-mode="redirect" data-success-page="/contactus-thank-you" data-pre-fill="true">
<div class="s_website_form_rows row s_col_no_bgcolor">
<div class="mb-3 col-12 s_website_form_field s_website_form_custom" data-type="char" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 150px" for="contact_name">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="contact_name">
<span class="s_website_form_label_content">Your Name</span>
<span class="s_website_form_mark">*</span>
<span class="s_website_form_mark"> *</span>
</label>
<div class="col-sm">
<input type="text" class="form-control s_website_form_input" name="name" required="" id="contact_name"/>
<input id="contact_name" type="text" class="form-control s_website_form_input" name="contact_name" required="" data-fill-with="name"/>
</div>
</div>
</div>
<!-- Email -->
<div class="col-12 s_website_form_field s_website_form_custom s_website_form_required" data-type="email" data-name="Field">
<div class="mb-3 col-12 s_website_form_field s_website_form_custom" data-type="tel" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 150px" for="contact_email">
<span class="s_website_form_label_content">Email Address</span>
<span class="s_website_form_mark">*</span>
</label>
<div class="col-sm">
<input type="email" class="form-control s_website_form_input" name="email_from" required="" id="contact_email"/>
</div>
</div>
</div>
<!-- Phone -->
<div class="col-12 s_website_form_field s_website_form_custom" data-type="char" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 150px" for="contact_phone">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="phone">
<span class="s_website_form_label_content">Phone Number</span>
</label>
<div class="col-sm">
<input type="tel" class="form-control s_website_form_input" name="phone" id="contact_phone"/>
<input id="phone" type="tel" class="form-control s_website_form_input" name="phone" data-fill-with="phone"/>
</div>
</div>
</div>
<!-- Subject -->
<div class="col-12 s_website_form_field s_website_form_custom" data-type="char" data-name="Field">
<div class="mb-3 col-12 s_website_form_field s_website_form_required" data-type="email" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 150px" for="contact_subject">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="email_from">
<span class="s_website_form_label_content">Email</span>
<span class="s_website_form_mark"> *</span>
</label>
<div class="col-sm">
<input id="email_from" type="email" class="form-control s_website_form_input" name="email_from" required="" data-fill-with="email"/>
</div>
</div>
</div>
<div class="mb-3 col-12 s_website_form_field s_website_form_custom" data-type="char" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="partner_name">
<span class="s_website_form_label_content">Company</span>
</label>
<div class="col-sm">
<input id="partner_name" type="text" class="form-control s_website_form_input" name="partner_name"/>
</div>
</div>
</div>
<div class="mb-3 col-12 s_website_form_field s_website_form_required" data-type="char" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="name">
<span class="s_website_form_label_content">Subject</span>
<span class="s_website_form_mark"> *</span>
</label>
<div class="col-sm">
<input type="text" class="form-control s_website_form_input" name="subject" id="contact_subject"/>
<input id="name" type="text" class="form-control s_website_form_input" name="name" required=""/>
</div>
</div>
</div>
<!-- Message -->
<div class="col-12 s_website_form_field s_website_form_custom s_website_form_required" data-type="text" data-name="Field">
<div class="mb-3 col-12 s_website_form_field s_website_form_required" data-type="text" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 150px" for="contact_message">
<span class="s_website_form_label_content">Your Message</span>
<span class="s_website_form_mark">*</span>
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="description">
<span class="s_website_form_label_content">Question</span>
<span class="s_website_form_mark"> *</span>
</label>
<div class="col-sm">
<textarea class="form-control s_website_form_input" name="description" rows="5" required="" id="contact_message"></textarea>
<textarea id="description" class="form-control s_website_form_input" name="description" required="" rows="5"></textarea>
</div>
</div>
</div>
<!-- Submit -->
<div class="col-12 s_website_form_submit text-end" data-name="Submit Button">
<button type="submit" class="btn btn-primary btn-lg px-5 flat" style="background-color: rgb(4, 18, 29); border-color: rgb(4, 18, 29); border-radius: 5px;">Send Message</button>
<div class="mb-3 col-12 s_website_form_submit" data-name="Submit Button">
<div style="width: 200px;" class="s_website_form_label"/>
<button type="submit" class="btn btn-primary btn-lg s_website_form_send">Submit</button>
<span id="s_website_form_result"></span>
</div>
</div>

39
debug_view.py Normal file
View File

@ -0,0 +1,39 @@
import logging
from odoo import http, tools, _
from odoo.http import request
def check_render(dbname):
try:
registry = odoo.registry(dbname)
with registry.cursor() as cr:
env = odoo.api.Environment(cr, odoo.SUPERUSER_ID, {})
# Try to render the contactus page view
# Typically 'website.contactus' is the template
print("Attempting to render website.contactus...")
try:
view_id = env.ref('website.contactus')
print(f"View ID: {view_id.id}")
# We need a website context
website = env['website'].browse(1)
# Mock request object if needed, or just use context
# Rendering view directly
arch = env['ir.ui.view']._render_template(view_id.id, {'main_object': view_id})
print("Render SUCCESS (length: {})".format(len(arch)))
except Exception as e:
print("Render FAILED:")
import traceback
traceback.print_exc()
print("-" * 20)
print("Checking for broken XPaths specifically on this view inheritance...")
# List inherited views
for inherit in view_id.inherit_children_ids:
print(f"Child View: {inherit.id} {inherit.name} (Active: {inherit.active})")
except Exception as e:
print(f"General failure: {e}")
if __name__ == "__main__":
check_render('FOODIES-DELIGHT')

View File

@ -1,4 +1,3 @@
version: "3.8"
services:
db:

17
dump_view.py Normal file
View File

@ -0,0 +1,17 @@
print("--- DUMPING THEME VIEW ---")
try:
theme_view = env.ref('theme_chennora.custom_homepage')
print(f"Name: {theme_view.name}")
print(f"ID: {theme_view.id}")
print(f"Type: {theme_view.type}")
print(f"Mode: {theme_view.mode}")
print(f"Active: {theme_view.active}")
print(f"Priority: {theme_view.priority}")
print(f"Inherit ID: {theme_view.inherit_id.id if theme_view.inherit_id else 'None'}")
print(f"Website ID: {theme_view.website_id.id if theme_view.website_id else 'None'}")
print(f"Key: {theme_view.key}")
print("Arch Snippet:")
print(theme_view.arch[:200])
except Exception as e:
print(f"Error: {e}")

46
fix_homepage.py Normal file
View File

@ -0,0 +1,46 @@
print("--- STARTING HOMEPAGE REPAIR ---")
try:
website = env['website'].get_current_website()
print(f"Target Website: {website.name}")
# 1. Find and Archive COW (Customized) Homepage Views
# These are usually created when you 'Edit' the homepage in the UI.
# They shadow the underlying theme/generic view.
cow_views = env['ir.ui.view'].search([
('key', '=', 'website.homepage'),
('website_id', '=', website.id),
('type', '=', 'qweb')
])
if cow_views:
print(f"Found {len(cow_views)} Blocking Custom View(s). Archiving them...")
for cv in cow_views:
print(f" -> Archiving View: {cv.name} (ID: {cv.id})")
cv.write({'active': False, 'key': cv.key + '.archived.' + str(cv.id)}) # Change key to stop it from matching
else:
print("No Blocking Custom Views (COW) found.")
# 2. Ensure Theme View is Active
theme_view = env.ref('theme_chennora.custom_homepage', raise_if_not_found=False)
if theme_view:
print(f"Theme View found: {theme_view.name}")
if not theme_view.active:
theme_view.write({'active': True})
print(" -> Activated Theme View")
else:
print(" -> Theme View is already active")
# Optional: Force priority check
if theme_view.priority < 50:
theme_view.write({'priority': 50})
print(" -> Enforced Priority 50")
else:
print("ERROR: Theme View 'theme_chennora.custom_homepage' NOT FOUND. Please upgrade the module.")
env.cr.commit()
print("--- REPAIR COMPLETE. PLEASE REFRESH HOMEPAGE ---")
except Exception as e:
print(f"ERROR: {e}")

37
force_inherit.py Normal file
View File

@ -0,0 +1,37 @@
print("--- FORCING INHERITANCE ---")
try:
# 1. Get the Generic Homepage
homepage = env.ref('website.homepage')
print(f"Generic Homepage: {homepage.name} (ID: {homepage.id})")
# 2. Get the Theme View
theme_view = env.ref('theme_chennora.custom_homepage', raise_if_not_found=False)
if not theme_view:
print("Theme view not found by XMLID! Searching by name...")
theme_view = env['ir.ui.view'].search([('name', '=', 'Chennora Homepage')], limit=1)
if theme_view:
print(f"Theme View Found: {theme_view.name} (ID: {theme_view.id})")
print(f" - Current Inherit ID: {theme_view.inherit_id.id if theme_view.inherit_id else 'None'}")
print(f" - Current Active: {theme_view.active}")
print(f" - Current Mode: {theme_view.mode}")
# 3. FORCE UPDATES
theme_view.write({
'inherit_id': homepage.id,
'active': True,
'mode': 'extension',
'priority': 50
})
print(" -> UPDATED: Assigned inherit_id, Active=True, Mode=extension")
else:
print("CRITICAL ERROR: Theme view could not be found via XMLID or Name.")
env.cr.commit()
print("--- FIX COMPLETE ---")
except Exception as e:
print(f"Error: {e}")

41
inspect_views.py Normal file
View File

@ -0,0 +1,41 @@
print("--- INSPECTING HOMEPAGE VIEWS ---")
try:
website = env['website'].get_current_website()
print(f"Current Website: {website.name} (ID: {website.id})")
# Check what view is being used for homepage
homepage_view = website.homepage_id or env.ref('website.homepage')
print(f"Homepage View: {homepage_view.name} (ID: {homepage_view.id}, Key: {homepage_view.key})")
print(f"Active: {homepage_view.active}")
# Check inheritance
print("Inherited Views:")
for view in homepage_view.inherit_children_ids:
print(f" - {view.name} (ID: {view.id}, Key: {view.key}, Active: {view.active}, Priority: {view.priority})")
if 'chennora' in view.key:
print(" ^^^ THIS IS YOUR THEME VIEW")
# Check for COW views (Specific views for this website that override the generic one)
cow_views = env['ir.ui.view'].search([
('key', '=', homepage_view.key),
('website_id', '=', website.id),
('type', '=', 'qweb')
])
if cow_views:
print("\nFound COW Views (Customized overrides):")
for cv in cow_views:
print(f" - {cv.name} (ID: {cv.id}, Active: {cv.active})")
print(" ARCH Content (first 100 chars):")
print(f" {cv.arch[:100]}...")
# Check if our theme view is actually in the db
theme_view = env.ref('theme_chennora.custom_homepage', raise_if_not_found=False)
if theme_view:
print(f"\nTheme View Record: {theme_view.name} (ID: {theme_view.id}, Active: {theme_view.active}, Priority: {theme_view.priority})")
else:
print("\nTheme View 'theme_chennora.custom_homepage' NOT FOUND in DB.")
except Exception as e:
print(f"Error: {e}")

46
inspect_views_v2.py Normal file
View File

@ -0,0 +1,46 @@
print("--- INSPECTING HOMEPAGE VIEWS (V2) ---")
try:
website = env['website'].get_current_website()
print(f"Current Website: {website.name} (ID: {website.id})")
# Standard Odoo Homepage View
generic_homepage_view = env.ref('website.homepage')
print(f"Generic Homepage View: {generic_homepage_view.name} (ID: {generic_homepage_view.id})")
# Check for COW views (Specific views for this website that override the generic one)
# COW views usually have the same key but a specific website_id
cow_views = env['ir.ui.view'].search([
('key', '=', 'website.homepage'),
('website_id', '=', website.id)
])
if cow_views:
print(f"\n[!] WARNING: Found {len(cow_views)} COW (Customized) Views for this website.")
for cv in cow_views:
print(f" - View Name: {cv.name} (ID: {cv.id}, Active: {cv.active}, Priority: {cv.priority})")
print(f" Mode: {cv.mode}")
print(f" Inherit ID: {cv.inherit_id.name if cv.inherit_id else 'None'}")
print(" This view is likely BLOCKING your theme changes.")
# Check our theme view
theme_view = env.ref('theme_chennora.custom_homepage', raise_if_not_found=False)
if theme_view:
print(f"\nTheme View Record: {theme_view.name} (ID: {theme_view.id})")
print(f" - Active: {theme_view.active}")
print(f" - Priority: {theme_view.priority}")
print(f" - Inherit ID: {theme_view.inherit_id.name if theme_view.inherit_id else 'None'}")
# Check if it is applied
if theme_view.id in generic_homepage_view.inherit_children_ids.ids:
print(" - Theme View IS in the inheritance tree of the generic homepage.")
else:
print(" - Theme View is NOT in the inheritance tree of the generic homepage.")
# If COW view exists, check if theme view is inherited by the COW view?
# Usually COW views replace the whole structure or inherit from the generic one but ignore other inherits if not careful.
else:
print("\n[!] ERROR: Theme View 'theme_chennora.custom_homepage' NOT FOUND in DB.")
except Exception as e:
print(f"Error: {e}")

30
read_arch.py Normal file
View File

@ -0,0 +1,30 @@
print("--- READING HOMEPAGE ARCH ---")
try:
homepage = env.ref('website.homepage')
print(f"Generic Homepage ID: {homepage.id}")
print(f"Arch:\n{homepage.arch}")
print("-" * 20)
current_website = env['website'].get_current_website()
print(f"Current Website ID: {current_website.id}")
# Check if this website has a specific homepage view set
# (some versions use homepage_view_id)
if 'homepage_id' in current_website._fields:
print(f"Website.homepage_id: {current_website.homepage_id}")
else:
print("Field homepage_id does not exist on website model.")
# Check for any view that inherits website.homepage and is active
inherits = env['ir.ui.view'].search([
('inherit_id', '=', homepage.id),
('active', '=', True)
])
print(f"Active Inheriting Views ({len(inherits)}):")
for v in inherits:
print(f" - {v.name} (ID: {v.id}, Key: {v.key}, Priority: {v.priority})")
except Exception as e:
print(f"Error: {e}")

27
resolve_homepage.py Normal file
View File

@ -0,0 +1,27 @@
print("--- RESOLVING HOMEPAGE ---")
try:
website = env['website'].get_current_website()
print(f"Current Website: {website.name} (ID: {website.id})")
# Resolve the view as Odoo does during rendering
resolved_view = website.viewref('website.homepage')
print(f"Resolved Homepage View: {resolved_view.name} (ID: {resolved_view.id}, Key: {resolved_view.key})")
print(f" - Website ID of View: {resolved_view.website_id.id}")
generic_view = env.ref('website.homepage')
print(f"Generic View ID: {generic_view.id}")
if resolved_view.id != generic_view.id:
print("!!! ALERT: Output resolves to a DIFFERENT view than the generic one. !!!")
print("This is a COW view masking your theme.")
print("Archiving this masking view now...")
resolved_view.write({'active': False, 'key': resolved_view.key + '.archived'})
print(" -> Archived masking view.")
else:
print("Resolved view IS the generic view.")
env.cr.commit()
print("--- CHECK COMPLETE ---")
except Exception as e:
print(f"Error: {e}")