From 9bbcbf9767145529968c6d305b5eddaeaa567542 Mon Sep 17 00:00:00 2001 From: Alaguraj0361 Date: Thu, 29 Jan 2026 16:23:22 +0530 Subject: [PATCH] Implement Chennora theme module with a custom homepage layout and add view inspection scripts. --- addons/debug_view.py | 47 ++++++++++ .../__pycache__/main.cpython-310.pyc | Bin 1643 -> 1627 bytes addons/home_dashboard/controllers/main.py | 2 +- addons/theme_chennora/__manifest__.py | 2 +- addons/theme_chennora/dump_home.py | 3 + addons/theme_chennora/views/layout.xml | 20 ++--- addons/theme_chennora/views/pages.xml | 85 +++++++++--------- debug_view.py | 39 ++++++++ docker-compose.yml | 1 - dump_view.py | 17 ++++ fix_homepage.py | 46 ++++++++++ force_inherit.py | 37 ++++++++ inspect_views.py | 41 +++++++++ inspect_views_v2.py | 46 ++++++++++ read_arch.py | 30 +++++++ resolve_homepage.py | 27 ++++++ 16 files changed, 390 insertions(+), 53 deletions(-) create mode 100644 addons/debug_view.py create mode 100644 addons/theme_chennora/dump_home.py create mode 100644 debug_view.py create mode 100644 dump_view.py create mode 100644 fix_homepage.py create mode 100644 force_inherit.py create mode 100644 inspect_views.py create mode 100644 inspect_views_v2.py create mode 100644 read_arch.py create mode 100644 resolve_homepage.py diff --git a/addons/debug_view.py b/addons/debug_view.py new file mode 100644 index 0000000..263c5fc --- /dev/null +++ b/addons/debug_view.py @@ -0,0 +1,47 @@ + +print("--- STARTING FIX SCRIPT ---") +try: + # In odoo shell, 'env' is available. + # Find active website (or first one) + websites = env['website'].search([]) + for w in websites: + print(f"Checking website: {w.name} (ID: {w.id})") + + # Check for COW view for this website + homepage_key = 'website.homepage' + cow_views = env['ir.ui.view'].search([ + ('key', '=', homepage_key), + ('website_id', '=', w.id) + ]) + + if cow_views: + print(f"Found {len(cow_views)} custom homepage views (COW) for {w.name}. Archiving them...") + for view in cow_views: + print(f" - Archiving view {view.name} (ID: {view.id})") + view.write({'active': False}) + else: + print(f"No custom homepage views found for {w.name}.") + + # Check theme view logic + # The theme view should replace website.homepage + theme_view = env.ref('theme_chennora.custom_homepage', raise_if_not_found=False) + if theme_view: + print(f"Theme view found: {theme_view.name} (ID: {theme_view.id}, Priority: {theme_view.priority})") + # Ensure it's active + if not theme_view.active: + theme_view.write({'active': True}) + print(" - Activated theme view") + + # Ensure priority is high enough to beat default but usually COW is the issue + if theme_view.priority < 50: + theme_view.write({'priority': 50}) + print(" - Updated priority to 50") + else: + print("WARNING: Theme view 'theme_chennora.custom_homepage' not found! Make sure the module is upgraded.") + + env.cr.commit() + print("--- FIX COMPLETE ---") +except Exception as e: + print(f"ERROR: {e}") + import traceback + traceback.print_exc() diff --git a/addons/home_dashboard/controllers/__pycache__/main.cpython-310.pyc b/addons/home_dashboard/controllers/__pycache__/main.cpython-310.pyc index aaae4698b495032fffd4d821a1700f3d0ffc49d4..245d9438809ec16e78da6d252b6febb989245ec4 100644 GIT binary patch delta 187 zcmaFObDM`dpO=@50SLZxRBz<|#Kh(RWEZ0&jW%`^g^WOHCci3y^3*jCi~=6RuyhZuwsagnXGb*e3N&u GZUzA25-bw{ delta 175 zcmcc3^O}b{pO=@50SG=Uj^D`riHQxwF7}zYUt+Q}v!X;hLmFcWR|As-TRQ^_ zLlk>3gC@^rALe#OFBYI$ZjgF0AW_0l!dS!5%#_8H!kEcW!?=X8j}fSp$*)KfD67d_ z!~>*?6hVYONPwwG7{nF@5#p02SydRtCfl(}GHG&5j$&0|kq3%T-oPX}c@nEAP-X?| FW&myIA_V{d diff --git a/addons/home_dashboard/controllers/main.py b/addons/home_dashboard/controllers/main.py index 4c83f7e..f0dc179 100644 --- a/addons/home_dashboard/controllers/main.py +++ b/addons/home_dashboard/controllers/main.py @@ -28,4 +28,4 @@ class ImageHome(Website): @http.route('/home', type='http', auth="public", website=True, sitemap=True) def website_home(self, **kw): # Explicit route for standard Website Homepage - return super(ImageHome, self).index(**kw) \ No newline at end of file + return request.render('website.homepage') \ No newline at end of file diff --git a/addons/theme_chennora/__manifest__.py b/addons/theme_chennora/__manifest__.py index 861a159..c564731 100644 --- a/addons/theme_chennora/__manifest__.py +++ b/addons/theme_chennora/__manifest__.py @@ -4,7 +4,7 @@ 'category': 'Theme/Website', 'version': '1.0', 'author': 'Your Company', - 'depends': ['website', 'website_sale'], + 'depends': ['website', 'website_sale', 'website_crm'], 'data': [ 'views/layout.xml', # Header, Footer, and Global Layout changes 'views/pages.xml', # specific page content (Home, About, etc.) diff --git a/addons/theme_chennora/dump_home.py b/addons/theme_chennora/dump_home.py new file mode 100644 index 0000000..8c467f3 --- /dev/null +++ b/addons/theme_chennora/dump_home.py @@ -0,0 +1,3 @@ +v = env['ir.ui.view'].browse(3221) +with open('/mnt/extra-addons/theme_chennora/view_3221.xml', 'w') as f: + f.write(str(v.arch_db)) diff --git a/addons/theme_chennora/views/layout.xml b/addons/theme_chennora/views/layout.xml index 7580c46..7afbcf8 100644 --- a/addons/theme_chennora/views/layout.xml +++ b/addons/theme_chennora/views/layout.xml @@ -5,12 +5,12 @@ - + - + @@ -178,16 +178,16 @@ - + - + - + @@ -208,7 +208,7 @@ - + @@ -217,12 +217,12 @@ - - '1' if 'header_visible' in main_object and not main_object.header_visible else None + + '1' if main_object and 'header_visible' in main_object and not main_object.header_visible else None - - '1' if 'footer_visible' in main_object and not main_object.footer_visible else None + + '1' if main_object and 'footer_visible' in main_object and not main_object.footer_visible else None diff --git a/addons/theme_chennora/views/pages.xml b/addons/theme_chennora/views/pages.xml index 533b1d0..90eb717 100644 --- a/addons/theme_chennora/views/pages.xml +++ b/addons/theme_chennora/views/pages.xml @@ -5,9 +5,9 @@ -