-
-
+
-
-
diff --git a/debug_view.py b/debug_view.py
new file mode 100644
index 0000000..0171e41
--- /dev/null
+++ b/debug_view.py
@@ -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')
diff --git a/docker-compose.yml b/docker-compose.yml
index 1a82f9f..221dc07 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,4 +1,3 @@
-version: "3.8"
services:
db:
diff --git a/dump_view.py b/dump_view.py
new file mode 100644
index 0000000..3e63ea3
--- /dev/null
+++ b/dump_view.py
@@ -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}")
diff --git a/fix_homepage.py b/fix_homepage.py
new file mode 100644
index 0000000..2b0ecdf
--- /dev/null
+++ b/fix_homepage.py
@@ -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}")
diff --git a/force_inherit.py b/force_inherit.py
new file mode 100644
index 0000000..2303589
--- /dev/null
+++ b/force_inherit.py
@@ -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}")
diff --git a/inspect_views.py b/inspect_views.py
new file mode 100644
index 0000000..be75109
--- /dev/null
+++ b/inspect_views.py
@@ -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}")
diff --git a/inspect_views_v2.py b/inspect_views_v2.py
new file mode 100644
index 0000000..b93370b
--- /dev/null
+++ b/inspect_views_v2.py
@@ -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}")
diff --git a/read_arch.py b/read_arch.py
new file mode 100644
index 0000000..47c6c8a
--- /dev/null
+++ b/read_arch.py
@@ -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}")
diff --git a/resolve_homepage.py b/resolve_homepage.py
new file mode 100644
index 0000000..d424fd1
--- /dev/null
+++ b/resolve_homepage.py
@@ -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}")