from odoo import env

def check_about_views():
    # Find the main About Us view
    about_view = env.ref('website.aboutus', raise_if_not_found=False)
    if not about_view:
        print("CRITICAL: 'website.aboutus' view not found!")
        return

    print(f"Base View: {about_view.name} (ID: {about_view.id}, Key: {about_view.key})")
    print(f"Arch Updated: {about_view.arch_updated}")
    
    # Check for specific views affecting this
    views = env['ir.ui.view'].search([('key', '=', 'website.aboutus')])
    for v in views:
         print(f"Found View with key='website.aboutus': {v.name} (ID: {v.id}, Model: {v.model}) - Active: {v.active}")

    # Check for inheriting views
    inheriting_views = env['ir.ui.view'].search([('inherit_id', '=', about_view.id)])
    print(f"\nInheriting Views ({len(inheriting_views)}):")
    for v in inheriting_views:
        print(f" - {v.name} (ID: {v.id}, Key: {v.key}, Priority: {v.priority}) - Active: {v.active}")
        
    # Check if there is a specific page record
    page = env['website.page'].search([('url', '=', '/aboutus')])
    if page:
        print(f"\nPage '/aboutus' found: {page.name} (View ID: {page.view_id.id})")
        if page.view_id != about_view:
             print(f"WARNING: Page is using a different view: {page.view_id.name} (ID: {page.view_id.id}, Key: {page.view_id.key})")
    else:
        print("\nPage '/aboutus' NOT found in website.page!")

    # Check /about just in case
    page_custom = env['website.page'].search([('url', '=', '/about')])
    if page_custom:
         print(f"\nPage '/about' found: {page_custom.name} (View ID: {page_custom.view_id.id})")

check_about_views()
