odoo-chennora-pos/force_inherit.py

38 lines
1.3 KiB
Python

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