From 7ac9ea413b8342722a0fd7d5387595d0073a9130 Mon Sep 17 00:00:00 2001 From: Ernesto Tejeda Date: Mon, 20 Mar 2023 08:42:08 +0100 Subject: [PATCH] [MIG] mrp_account: Migration to 15.0 --- docsource/modules140-150.rst | 2 +- .../mrp_account/15.0.1.0/pre-migration.py | 26 +++++++++++++++++++ .../15.0.1.0/upgrade_analysis_work.txt | 21 +++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 openupgrade_scripts/scripts/mrp_account/15.0.1.0/pre-migration.py create mode 100644 openupgrade_scripts/scripts/mrp_account/15.0.1.0/upgrade_analysis_work.txt diff --git a/docsource/modules140-150.rst b/docsource/modules140-150.rst index 3ca52d28e9e6..8cf881618b02 100644 --- a/docsource/modules140-150.rst +++ b/docsource/modules140-150.rst @@ -514,7 +514,7 @@ Module coverage 14.0 -> 15.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | mrp | Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| mrp_account | | | +| mrp_account | Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | mrp_landed_costs | |No DB layout changes. | +-------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/mrp_account/15.0.1.0/pre-migration.py b/openupgrade_scripts/scripts/mrp_account/15.0.1.0/pre-migration.py new file mode 100644 index 000000000000..8e698b623b4c --- /dev/null +++ b/openupgrade_scripts/scripts/mrp_account/15.0.1.0/pre-migration.py @@ -0,0 +1,26 @@ +# Copyright 2023 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openupgradelib import openupgrade + +def pre_create_mrp_production_analytic_account_id(env): + """ Pre-create the column for avoiding computation on module upgrade """ + if openupgrade.column_exists(env.cr, "mrp_production", "analytic_account_id"): + return + openupgrade.add_fields( + env, + [ + ( + "analytic_account_id", + "mrp.production", + "mrp_production", + "many2one", + False, + "mrp_account", + ) + ], + ) + +@openupgrade.migrate() +def migrate(env, version): + pre_create_mrp_production_analytic_account_id(env) diff --git a/openupgrade_scripts/scripts/mrp_account/15.0.1.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/mrp_account/15.0.1.0/upgrade_analysis_work.txt new file mode 100644 index 000000000000..3fdb7b8db988 --- /dev/null +++ b/openupgrade_scripts/scripts/mrp_account/15.0.1.0/upgrade_analysis_work.txt @@ -0,0 +1,21 @@ +---Models in module 'mrp_account'--- +---Fields in module 'mrp_account'--- +mrp_account / account.analytic.account / bom_ids (one2many) : NEW relation: mrp.bom +mrp_account / account.analytic.account / production_ids (one2many) : NEW relation: mrp.production +mrp_account / account.analytic.account / workcenter_ids (one2many) : NEW relation: mrp.workcenter +mrp_account / account.analytic.line / category (False) : NEW selection_keys: ['invoice', 'manufacturing_order', 'other', 'vendor_bill'], mode: modify +mrp_account / mrp.bom / analytic_account_id (many2one): NEW relation: account.analytic.account +# NOTHING TO DO: new feature + +mrp_account / mrp.production / analytic_account_id (many2one): NEW relation: account.analytic.account, hasdefault: compute +# DONE: pre-migration: pre-create column 'analytic_account_id' for avoiding computation on module upgrade + +mrp_account / mrp.workorder / mo_analytic_account_line_id (many2one): NEW relation: account.analytic.line +mrp_account / mrp.workorder / wc_analytic_account_line_id (many2one): NEW relation: account.analytic.line +# NOTHING TO DO: new feature + +---XML records in module 'mrp_account'--- +NEW ir.ui.view: mrp_account.account_analytic_account_view_form_mrp +NEW ir.ui.view: mrp_account.mrp_bom_form_view_inherited +NEW ir.ui.view: mrp_account.view_production_graph_inherit_mrp_account +# NOTHING TO DO: new records