diff --git a/docsource/modules130-140.rst b/docsource/modules130-140.rst index 4edca824295e..d09061be217e 100644 --- a/docsource/modules130-140.rst +++ b/docsource/modules130-140.rst @@ -72,7 +72,7 @@ Module coverage 13.0 -> 14.0 +--------------------------------------------+-------------------------------------------------+ |base_address_extended | Nothing to do | +--------------------------------------------+-------------------------------------------------+ -|base_automation | | +|base_automation | Done | +--------------------------------------------+-------------------------------------------------+ | |del| base_gengo | | +--------------------------------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/base_automation/14.0.1.0/post-migration.py b/openupgrade_scripts/scripts/base_automation/14.0.1.0/post-migration.py new file mode 100644 index 000000000000..74eaa2588f3d --- /dev/null +++ b/openupgrade_scripts/scripts/base_automation/14.0.1.0/post-migration.py @@ -0,0 +1,31 @@ +# Copyright 2021 ForgeFlow S.L. +# Copyright 2021 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from openupgradelib import openupgrade + + +def fill_base_automation_ir_model_fields_rel(env): + openupgrade.logged_query( + env.cr, + """ + WITH q1 AS ( + SELECT ba.id, unnest( + string_to_array(ba.on_change_fields, ',') + ) AS field, ias.model_id + FROM base_automation ba + JOIN ir_act_server ias ON ba.action_server_id = ias.id + WHERE ba.on_change_fields is not null + ) + INSERT INTO base_automation_onchange_fields_rel + (base_automation_id, ir_model_fields_id) + SELECT q1.id, imf.id + FROM ir_model_fields AS imf + JOIN q1 ON imf.name = q1.field + WHERE imf.model_id = q1.model_id + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + fill_base_automation_ir_model_fields_rel(env) diff --git a/openupgrade_scripts/scripts/base_automation/14.0.1.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/base_automation/14.0.1.0/upgrade_analysis_work.txt new file mode 100644 index 000000000000..27474cefab52 --- /dev/null +++ b/openupgrade_scripts/scripts/base_automation/14.0.1.0/upgrade_analysis_work.txt @@ -0,0 +1,38 @@ +---Models in module 'base_automation'--- +model base.automation.lead.test (moved to test_base_automation) +model base.automation.line.test (moved to test_base_automation) +# NOTHING TO DO: Lead test and line test moved to new module test_base_automation to define the models + +---Fields in module 'base_automation'--- +base_automation / base.automation / on_change_fields (char) : DEL +base_automation / base.automation / on_change_field_ids (many2many): NEW relation: ir.model.fields +# DONE: post-migration: filled m2m relation table +# Field name changed as now uses a m2m relation instead of char with the list of fields that trigger on_change + +base_automation / base.automation.lead.test / __last_update (datetime) : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.lead.test / _order : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.lead.test / active (boolean) : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.lead.test / date_action_last (datetime) : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.lead.test / deadline (boolean) : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.lead.test / display_name (char) : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.lead.test / employee (boolean) : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.lead.test / is_assigned_to_admin (boolean): module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.lead.test / line_ids (one2many) : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.lead.test / name (char) : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.lead.test / partner_id (many2one) : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.lead.test / priority (boolean) : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.lead.test / state (selection) : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.lead.test / user_id (many2one) : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.line.test / __last_update (datetime) : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.line.test / _order : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.line.test / display_name (char) : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.line.test / lead_id (many2one) : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.line.test / name (char) : module is now 'test_base_automation' ('base_automation') +base_automation / base.automation.line.test / user_id (many2one) : module is now 'test_base_automation' ('base_automation') +# NOTHING TO DO + +---XML records in module 'base_automation'--- +DEL ir.model.access: base_automation.access_base_automation +DEL ir.model.access: base_automation.access_base_automation_lead_test [renamed to test_base_automation module] +DEL ir.model.access: base_automation.access_base_automation_line_test [renamed to test_base_automation module] +# NOTHING TO DO