p = env['website.page'].search([('url', '=', '/'), ('website_id', '=', 6)], limit=1) v = env.ref('theme_clicks2cart.clicks2cart_homepage_v17', False) print('Current page view:', p.view_id.id if p else 'No page found') print('Custom view:', v.id if v else 'Not found') if p and v: p.view_id = v env.cr.commit() print('Updated successfully!')