odoo-chennora-pos/inspect_views.py

42 lines
1.7 KiB
Python

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}")