From 77e36f8340d2b0db1c76988463758b12906c96dc Mon Sep 17 00:00:00 2001 From: Alexis Date: Wed, 18 Sep 2024 16:55:56 -0400 Subject: [PATCH 1/2] [17.0][OU-ADD] purchase: Migration to 17.0 --- .../scripts/purchase/17.0.1.2/post-migration.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 openupgrade_scripts/scripts/purchase/17.0.1.2/post-migration.py diff --git a/openupgrade_scripts/scripts/purchase/17.0.1.2/post-migration.py b/openupgrade_scripts/scripts/purchase/17.0.1.2/post-migration.py new file mode 100644 index 000000000000..57342aeb17c0 --- /dev/null +++ b/openupgrade_scripts/scripts/purchase/17.0.1.2/post-migration.py @@ -0,0 +1,9 @@ +# Copyright 2024 Viindoo Technology Joint Stock Company (Viindoo) +# 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, "purchase", "17.0.1.2/noupdate_changes.xml") From a780de0db1b58d549f6a02275ad8d55735370c3d Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Mon, 16 Dec 2024 19:32:15 +0100 Subject: [PATCH 2/2] [OU-IMP] purchase: add work file, precreate column, mark done --- docsource/modules160-170.rst | 2 +- .../purchase/17.0.1.2/pre-migration.py | 10 +++++++++ .../17.0.1.2/upgrade_analysis_work.txt | 21 +++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 openupgrade_scripts/scripts/purchase/17.0.1.2/pre-migration.py create mode 100644 openupgrade_scripts/scripts/purchase/17.0.1.2/upgrade_analysis_work.txt diff --git a/docsource/modules160-170.rst b/docsource/modules160-170.rst index 38797c9741a8..6af359c6ddc2 100644 --- a/docsource/modules160-170.rst +++ b/docsource/modules160-170.rst @@ -724,7 +724,7 @@ Module coverage 16.0 -> 17.0 +---------------------------------------------------+----------------------+-------------------------------------------------+ | |new| project_todo | |Renamed from note. | +---------------------------------------------------+----------------------+-------------------------------------------------+ -| purchase | | | +| purchase | Done | | +---------------------------------------------------+----------------------+-------------------------------------------------+ | purchase_mrp | | | +---------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/purchase/17.0.1.2/pre-migration.py b/openupgrade_scripts/scripts/purchase/17.0.1.2/pre-migration.py new file mode 100644 index 000000000000..cab654482870 --- /dev/null +++ b/openupgrade_scripts/scripts/purchase/17.0.1.2/pre-migration.py @@ -0,0 +1,10 @@ +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version=None): + if not openupgrade.column_exists(env.cr, "purchase_order_line", "discount"): + openupgrade.logged_query( + env.cr, "ALTER TABLE purchase_order_line ADD COLUMN discount FLOAT" + ) + openupgrade.logged_query(env.cr, "UPDATE purchase_order_line SET discount=0") diff --git a/openupgrade_scripts/scripts/purchase/17.0.1.2/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/purchase/17.0.1.2/upgrade_analysis_work.txt new file mode 100644 index 000000000000..1dceb8cb7d83 --- /dev/null +++ b/openupgrade_scripts/scripts/purchase/17.0.1.2/upgrade_analysis_work.txt @@ -0,0 +1,21 @@ +---Models in module 'purchase'--- +---Fields in module 'purchase'--- +purchase / purchase.order / activity_user_id (many2one) : not related anymore +purchase / purchase.order / activity_user_id (many2one) : now a function +purchase / purchase.order / message_main_attachment_id (many2one): DEL relation: ir.attachment +purchase / purchase.order / rating_ids (one2many) : NEW relation: rating.rating +# NOTHING TO DO + +purchase / purchase.order.line / discount (float) : NEW hasdefault: compute +# DONE: create column in pre-migration to avoid expensive recomputation + +purchase / res.partner / buyer_id (many2one) : NEW relation: res.users +# NOTHING TO DO + +---XML records in module 'purchase'--- +NEW ir.ui.view: purchase.document_tax_totals +NEW ir.ui.view: purchase.product_template_search_view_purchase +NEW ir.ui.view: purchase.product_view_kanban_catalog_purchase_only +NEW ir.ui.view: purchase.product_view_search_catalog +NEW ir.ui.view: purchase.view_product_product_supplier_inherit +# NOTHING TO DO