From 3daf59726833fe0fe414f554161fdf1d50ca6d13 Mon Sep 17 00:00:00 2001 From: mreficent Date: Fri, 14 Feb 2020 12:46:22 +0100 Subject: [PATCH] [MIG] delivery --- .../migrations/13.0.1.0/noupdate_changes.xml | 2 +- .../13.0.1.0/openupgrade_analysis_work.txt | 27 +++++++++++++++++++ .../migrations/13.0.1.0/post-migration.py | 19 +++++++++++++ .../migrations/13.0.1.0/pre-migration.py | 15 +++++++++++ .../openupgrade/doc/source/modules120-130.rst | 2 +- 5 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 addons/delivery/migrations/13.0.1.0/openupgrade_analysis_work.txt create mode 100644 addons/delivery/migrations/13.0.1.0/post-migration.py create mode 100644 addons/delivery/migrations/13.0.1.0/pre-migration.py diff --git a/addons/delivery/migrations/13.0.1.0/noupdate_changes.xml b/addons/delivery/migrations/13.0.1.0/noupdate_changes.xml index 2bec5671fe09..80fb99d5e16c 100644 --- a/addons/delivery/migrations/13.0.1.0/noupdate_changes.xml +++ b/addons/delivery/migrations/13.0.1.0/noupdate_changes.xml @@ -1,7 +1,7 @@ - + ['|', ('company_id', 'in', company_ids), ('company_id', '=', False)] diff --git a/addons/delivery/migrations/13.0.1.0/openupgrade_analysis_work.txt b/addons/delivery/migrations/13.0.1.0/openupgrade_analysis_work.txt new file mode 100644 index 000000000000..a53ccc91e11b --- /dev/null +++ b/addons/delivery/migrations/13.0.1.0/openupgrade_analysis_work.txt @@ -0,0 +1,27 @@ +---Models in module 'delivery'--- +new model choose.delivery.carrier [transient] +# NOTHING TO DO + +---Fields in module 'delivery'--- +delivery / delivery.carrier / get_return_label_from_portal (boolean): NEW +delivery / delivery.carrier / invoice_policy (selection) : NEW required, selection_keys: ['estimated', 'real'], req_default: function, hasdefault +delivery / delivery.carrier / margin (integer) : type is now 'float' ('integer') +delivery / delivery.carrier / return_label_on_delivery (boolean): NEW +delivery / sale.order / delivery_price (float) : DEL +delivery / sale.order / invoice_shipping_on_delivery (boolean): DEL +# NOTHING TO DO + +delivery / sale.order / recompute_delivery_price (boolean): NEW +# DONE: post-migration: marked as True if it has carrier + +---XML records in module 'delivery'--- +NEW ir.ui.view: delivery.choose_delivery_carrier_view_form +NEW ir.ui.view: delivery.product_template_hs_code +NEW ir.ui.view: delivery.sale_order_portal_content_inherit_sale_stock_inherit_website_sale_delivery +NEW ir.ui.view: delivery.vpicktree_view_tree +DEL ir.ui.view: delivery.assets_backend +DEL ir.ui.view: delivery_hs_code.product_template_hs_code +# NOTHING TO DO + +DEL mail.template: delivery.mail_template_data_delivery_confirmation [renamed to stock module] (noupdate) +# NOTHING TO DO: handled in stock diff --git a/addons/delivery/migrations/13.0.1.0/post-migration.py b/addons/delivery/migrations/13.0.1.0/post-migration.py new file mode 100644 index 000000000000..77c24a0192a0 --- /dev/null +++ b/addons/delivery/migrations/13.0.1.0/post-migration.py @@ -0,0 +1,19 @@ +# Copyright 2020 ForgeFlow +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from openupgradelib import openupgrade + + +def fill_sale_order_recompute_delivery_price(env): + openupgrade.logged_query( + env.cr, """ + UPDATE sale_order + SET recompute_delivery_price = TRUE + WHERE carrier_id IS NOT NULL""" + ) + + +@openupgrade.migrate() +def migrate(env, version): + fill_sale_order_recompute_delivery_price(env) + openupgrade.load_data( + env.cr, "delivery", "migrations/13.0.1.0/noupdate_changes.xml") diff --git a/addons/delivery/migrations/13.0.1.0/pre-migration.py b/addons/delivery/migrations/13.0.1.0/pre-migration.py new file mode 100644 index 000000000000..1fd48e0b29e9 --- /dev/null +++ b/addons/delivery/migrations/13.0.1.0/pre-migration.py @@ -0,0 +1,15 @@ +# Copyright 2020 ForgeFlow +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from openupgradelib import openupgrade + + +_column_renames = { + 'sale_order': [ + ('delivery_price', None), # save value just in case + ], +} + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.rename_columns(env.cr, _column_renames) diff --git a/odoo/openupgrade/doc/source/modules120-130.rst b/odoo/openupgrade/doc/source/modules120-130.rst index da5f8ee20728..91a62f4e7e0a 100644 --- a/odoo/openupgrade/doc/source/modules120-130.rst +++ b/odoo/openupgrade/doc/source/modules120-130.rst @@ -123,7 +123,7 @@ missing in the new release are marked with |del|. +----------------------------------------------+-------------------------------------------------+ | |del| decimal_precision | | +----------------------------------------------+-------------------------------------------------+ -|delivery | | +|delivery | Done | +----------------------------------------------+-------------------------------------------------+ | |del| delivery_hs_code | | +----------------------------------------------+-------------------------------------------------+