-
-
Notifications
You must be signed in to change notification settings - Fork 700
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2670 from ForgeFlow/14.0-mig-base_automation
[14.0][MIG] base_automation
- Loading branch information
Showing
3 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
openupgrade_scripts/scripts/base_automation/14.0.1.0/post-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2021 ForgeFlow S.L. <https://www.forgeflow.com> | ||
# 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) |
38 changes: 38 additions & 0 deletions
38
openupgrade_scripts/scripts/base_automation/14.0.1.0/upgrade_analysis_work.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |