Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][MIG] base_automation #2670

Merged
merged 1 commit into from
Jul 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docsource/modules130-140.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Module coverage 13.0 -> 14.0
+--------------------------------------------+-------------------------------------------------+
|base_address_extended | Nothing to do |
+--------------------------------------------+-------------------------------------------------+
|base_automation | |
|base_automation | Done |
+--------------------------------------------+-------------------------------------------------+
| |del| base_gengo | |
+--------------------------------------------+-------------------------------------------------+
Expand Down
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

RaulOForgeFlow marked this conversation as resolved.
Show resolved Hide resolved

def fill_base_automation_ir_model_fields_rel(env):
openupgrade.logged_query(
env.cr,
"""
RaulOForgeFlow marked this conversation as resolved.
Show resolved Hide resolved
WITH q1 AS (
SELECT ba.id, unnest(
string_to_array(ba.on_change_fields, ',')
RaulOForgeFlow marked this conversation as resolved.
Show resolved Hide resolved
) 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
""",
RaulOForgeFlow marked this conversation as resolved.
Show resolved Hide resolved
)


@openupgrade.migrate()
def migrate(env, version):
fill_base_automation_ir_model_fields_rel(env)
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