From 1ba74022ac8b67fcd6cbb4c8a16e8bab7f9b8f82 Mon Sep 17 00:00:00 2001 From: mreficent Date: Fri, 24 Apr 2020 16:57:09 +0200 Subject: [PATCH] [MIG] snailmail --- .../13.0.0.1/openupgrade_analysis_work.txt | 36 +++++++++++++++++++ .../migrations/13.0.0.1/post-migration.py | 19 ++++++++++ .../migrations/13.0.0.1/pre-migration.py | 14 ++++++++ .../openupgrade/doc/source/modules120-130.rst | 2 +- 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 addons/snailmail/migrations/13.0.0.1/openupgrade_analysis_work.txt create mode 100644 addons/snailmail/migrations/13.0.0.1/post-migration.py create mode 100644 addons/snailmail/migrations/13.0.0.1/pre-migration.py diff --git a/addons/snailmail/migrations/13.0.0.1/openupgrade_analysis_work.txt b/addons/snailmail/migrations/13.0.0.1/openupgrade_analysis_work.txt new file mode 100644 index 000000000000..e83d122c6cc8 --- /dev/null +++ b/addons/snailmail/migrations/13.0.0.1/openupgrade_analysis_work.txt @@ -0,0 +1,36 @@ +---Models in module 'snailmail'--- +new model snailmail.letter.cancel [transient] +new model snailmail.letter.format.error [transient] +new model snailmail.letter.missing.required.fields [transient] +# NOTHING TO DO + +---Fields in module 'snailmail'--- +snailmail / mail.message / letter_ids (one2many) : NEW relation: snailmail.letter +snailmail / mail.message / message_type (False) : NEW selection_keys: ['comment', 'email', 'notification', 'snailmail', 'user_notification'], mode: modify +snailmail / res.company / snailmail_cover (boolean) : NEW hasdefault +snailmail / snailmail.letter / city (char) : NEW +snailmail / snailmail.letter / country_id (many2one) : NEW relation: res.country +snailmail / snailmail.letter / cover (boolean) : NEW hasdefault +snailmail / snailmail.letter / error_code (selection) : NEW selection_keys: ['CREDIT_ERROR', 'FORMAT_ERROR', 'MISSING_REQUIRED_FIELDS', 'NO_PRICE_AVAILABLE', 'TRIAL_ERROR', 'UNKNOWN_ERROR'] +snailmail / snailmail.letter / message_id (many2one) : NEW relation: mail.message +snailmail / snailmail.letter / state_id (many2one) : NEW relation: res.country.state +snailmail / snailmail.letter / street (char) : NEW +snailmail / snailmail.letter / street2 (char) : NEW +snailmail / snailmail.letter / zip (char) : NEW +# NOTHING TO DO (?): new features + +snailmail / snailmail.letter / state (selection) : now required, req_default: function +snailmail / snailmail.letter / state (selection) : selection_keys is now '['canceled', 'error', 'pending', 'sent']' ('['canceled', 'draft', 'error', 'pending', 'sent']') +# DONE: post-migration: mapped 'draft' state to 'pending' + +---XML records in module 'snailmail'--- +NEW ir.actions.act_window: snailmail.snailmail_letter_cancel_action +NEW ir.actions.act_window: snailmail.snailmail_letter_format_error_action +NEW ir.actions.act_window: snailmail.snailmail_letter_missing_required_fields_action +NEW ir.ui.view: snailmail.assets_backend +NEW ir.ui.view: snailmail.qunit_suite +NEW ir.ui.view: snailmail.snailmail_letter_cancel +NEW ir.ui.view: snailmail.snailmail_letter_format_error +NEW ir.ui.view: snailmail.snailmail_letter_missing_required_fields +DEL ir.ui.view: snailmail.res_config_settings_view_form +# NOTHING TO DO diff --git a/addons/snailmail/migrations/13.0.0.1/post-migration.py b/addons/snailmail/migrations/13.0.0.1/post-migration.py new file mode 100644 index 000000000000..e1215aa4fd0e --- /dev/null +++ b/addons/snailmail/migrations/13.0.0.1/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 map_snailmail_letter_state(env): + openupgrade.map_values( + env.cr, + openupgrade.get_legacy_name('state'), + 'state', + [('draft', 'pending'), + ], + table='snailmail_letter', + ) + + +@openupgrade.migrate() +def migrate(env, version): + map_snailmail_letter_state(env) diff --git a/addons/snailmail/migrations/13.0.0.1/pre-migration.py b/addons/snailmail/migrations/13.0.0.1/pre-migration.py new file mode 100644 index 000000000000..bb6b13374187 --- /dev/null +++ b/addons/snailmail/migrations/13.0.0.1/pre-migration.py @@ -0,0 +1,14 @@ +# Copyright 2020 ForgeFlow +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from openupgradelib import openupgrade + +_column_copies = { + 'snailmail_letter': [ + ('state', None, None), + ], +} + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.copy_columns(env.cr, _column_copies) diff --git a/odoo/openupgrade/doc/source/modules120-130.rst b/odoo/openupgrade/doc/source/modules120-130.rst index da5f8ee20728..17237c055566 100644 --- a/odoo/openupgrade/doc/source/modules120-130.rst +++ b/odoo/openupgrade/doc/source/modules120-130.rst @@ -589,7 +589,7 @@ missing in the new release are marked with |del|. +----------------------------------------------+-------------------------------------------------+ |sms | | +----------------------------------------------+-------------------------------------------------+ -|snailmail | | +|snailmail | Done | +----------------------------------------------+-------------------------------------------------+ |snailmail_account | | +----------------------------------------------+-------------------------------------------------+