Skip to content

Commit

Permalink
Merge pull request OCA#4539 from Tecnativa/15.0-ou-fix-website-handle…
Browse files Browse the repository at this point in the history
…_domain

[15.0][OU-FIX] website: ensure domain protocol prefix
  • Loading branch information
pedrobaeza authored Aug 13, 2024
2 parents e09e5e4 + 51aa893 commit 9af4744
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions openupgrade_scripts/scripts/website/15.0.1.0/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ def update_contact_form_company_description(env):
website_contactus_view.with_context(website_id=website.id).arch = new_arch


def handle_domain_protocol(env):
"""We need to ensure the website protocol prefix to ensure each site correct
redirection"""
for website in env["website"].search([("domain", "!=", False)]):
if website.domain.startswith("http"):
continue
website.domain = f"https://{website.domain.rstrip('/')}"


@openupgrade.migrate()
def migrate(env, version):
openupgrade.logged_query(env.cr, "UPDATE website SET configurator_done = True")
Expand All @@ -118,3 +127,4 @@ def migrate(env, version):
update_website_form_call(env)
extract_footer_copyright_company_name(env)
update_contact_form_company_description(env)
handle_domain_protocol(env)

0 comments on commit 9af4744

Please sign in to comment.