odoo-testing-addons/inspect_views_v2.py
2026-01-31 08:29:51 -05:00

48 lines
2.2 KiB
Python

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('dine360_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 'dine360_theme_chennora.custom_homepage' NOT FOUND in DB.")
except Exception as e:
print(f"Error: {e}")