Skip to content

Commit

Permalink
Merge pull request #2319 from ForgeFlow/13.0-mig-snailmail-script
Browse files Browse the repository at this point in the history
[13.0][MIG] snailmail
  • Loading branch information
pedrobaeza authored Feb 16, 2021
2 parents 227ae8b + 1ba7402 commit 3a67d76
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 1 deletion.
36 changes: 36 additions & 0 deletions addons/snailmail/migrations/13.0.0.1/openupgrade_analysis_work.txt
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions addons/snailmail/migrations/13.0.0.1/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2020 ForgeFlow <http://www.forgeflow.com>
# 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)
14 changes: 14 additions & 0 deletions addons/snailmail/migrations/13.0.0.1/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2020 ForgeFlow <http://www.forgeflow.com>
# 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)
2 changes: 1 addition & 1 deletion odoo/openupgrade/doc/source/modules120-130.rst
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ missing in the new release are marked with |del|.
+----------------------------------------------+-------------------------------------------------+
|sms | Done |
+----------------------------------------------+-------------------------------------------------+
|snailmail | |
|snailmail | Done |
+----------------------------------------------+-------------------------------------------------+
|snailmail_account | |
+----------------------------------------------+-------------------------------------------------+
Expand Down

0 comments on commit 3a67d76

Please sign in to comment.