From 9a5e4395a2b9ee387e68020816850a04689da1a3 Mon Sep 17 00:00:00 2001
From: Carlos Lopez <carlos.lopez@tecnativa.com>
Date: Fri, 22 Aug 2025 15:12:59 -0500
Subject: [PATCH] [OU-ADD] website_sale_picking: Migration scripts

---
 docsource/modules160-170.rst                  |  2 +-
 .../17.0.1.0/post-migration.py                | 15 +++++++++++++++
 .../17.0.1.0/pre-migration.py                 | 19 +++++++++++++++++++
 .../17.0.1.0/upgrade_analysis_work.txt        | 12 ++++++++++++
 4 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 openupgrade_scripts/scripts/website_sale_picking/17.0.1.0/post-migration.py
 create mode 100644 openupgrade_scripts/scripts/website_sale_picking/17.0.1.0/pre-migration.py
 create mode 100644 openupgrade_scripts/scripts/website_sale_picking/17.0.1.0/upgrade_analysis_work.txt

diff --git a/docsource/modules160-170.rst b/docsource/modules160-170.rst
index 18c9c811f8d9..5cfc85da2b75 100644
--- a/docsource/modules160-170.rst
+++ b/docsource/modules160-170.rst
@@ -1126,7 +1126,7 @@ Module coverage 16.0 -> 17.0
 +---------------------------------------------------+----------------------+-------------------------------------------------+
 | |new| website_sale_mondialrelay                   |                      |Renamed from website_sale_delivery_mondialrelay. |
 +---------------------------------------------------+----------------------+-------------------------------------------------+
-| website_sale_picking                              |                      |                                                 |
+| website_sale_picking                              | Done                 |                                                 |
 +---------------------------------------------------+----------------------+-------------------------------------------------+
 | website_sale_product_configurator                 |                      |                                                 |
 +---------------------------------------------------+----------------------+-------------------------------------------------+
diff --git a/openupgrade_scripts/scripts/website_sale_picking/17.0.1.0/post-migration.py b/openupgrade_scripts/scripts/website_sale_picking/17.0.1.0/post-migration.py
new file mode 100644
index 000000000000..5b9c49c4067c
--- /dev/null
+++ b/openupgrade_scripts/scripts/website_sale_picking/17.0.1.0/post-migration.py
@@ -0,0 +1,15 @@
+# Copyright 2025 Tecnativa - Carlos Lopez
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+
+from openupgradelib import openupgrade
+
+
+@openupgrade.migrate()
+def migrate(env, version):
+    openupgrade.load_data(env, "website_sale_picking", "17.0.1.0/noupdate_changes.xml")
+    openupgrade.delete_record_translations(
+        env.cr,
+        "website_sale_picking",
+        ["onsite_delivery_product"],
+        ["description"],
+    )
diff --git a/openupgrade_scripts/scripts/website_sale_picking/17.0.1.0/pre-migration.py b/openupgrade_scripts/scripts/website_sale_picking/17.0.1.0/pre-migration.py
new file mode 100644
index 000000000000..5085441a3fea
--- /dev/null
+++ b/openupgrade_scripts/scripts/website_sale_picking/17.0.1.0/pre-migration.py
@@ -0,0 +1,19 @@
+# Copyright 2025 Tecnativa - Carlos Lopez
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+from openupgradelib import openupgrade
+
+_noupdate_xmlids = ["payment_provider_onsite"]
+_xmlid_renames = [
+    (
+        "website_sale_picking.checkout_payment",
+        "website_sale_picking.payment_method_form",
+    )
+]
+
+
+@openupgrade.migrate()
+def migrate(env, version):
+    openupgrade.set_xml_ids_noupdate_value(
+        env, "website_sale_picking", _noupdate_xmlids, False
+    )
+    openupgrade.rename_xmlids(env.cr, _xmlid_renames)
diff --git a/openupgrade_scripts/scripts/website_sale_picking/17.0.1.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/website_sale_picking/17.0.1.0/upgrade_analysis_work.txt
new file mode 100644
index 000000000000..9e2591f93fd3
--- /dev/null
+++ b/openupgrade_scripts/scripts/website_sale_picking/17.0.1.0/upgrade_analysis_work.txt
@@ -0,0 +1,12 @@
+---Models in module 'website_sale_picking'---
+---Fields in module 'website_sale_picking'---
+---XML records in module 'website_sale_picking'---
+NEW ir.ui.view: website_sale_picking.payment_method_form
+DEL ir.ui.view: website_sale_picking.checkout_payment
+# DONE: pre-migration: XML-ID renamed
+
+NEW payment.method: website_sale_picking.payment_method_pay_on_site
+# NOTHING TO DO: New record used to set in payment.provider payment_provider_onsite
+
+payment.provider: website_sale_picking.payment_provider_onsite (noupdate switched)
+# DONE: pre-migration: Switch noupdate flag
