Skip to content

Commit

Permalink
添加openupgrade_framework代码OCA#4327
Browse files Browse the repository at this point in the history
parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058855 +0000

parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058818 +0000

添加openupgrade_framework代码OCA#4327

增加upgrade_anaylysis_work.txt

init base migration script

初步完成base模块的升级脚本

初步添加account模块升级脚本

修复文件名错误

BUG Fix

增加mail模块升级脚本

完成mail升级脚本

初步添加hr升级脚本

完成hr模块升级脚本

完成account模块升级脚本

更新模块清单

添加sale_management升级脚本

修复升级问题

完善project模块升级脚本

增加一堆模块no_update的处理

BUG Fix

暂时移除delivery升级脚本

改进项目升级脚本

添加针对hr_responsible_id字段的处理

增加auth_signup升级脚本

修复mail_alias上的mail_channel数据

添加openupgrade_framework代码OCA#4327

parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058855 +0000

parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058818 +0000

添加openupgrade_framework代码OCA#4327

增加upgrade_anaylysis_work.txt

init base migration script

初步完成base模块的升级脚本

初步添加account模块升级脚本

修复文件名错误

BUG Fix

增加mail模块升级脚本

完成mail升级脚本

初步添加hr升级脚本

完成hr模块升级脚本

完成account模块升级脚本

更新模块清单

添加sale_management升级脚本

修复升级问题

完善project模块升级脚本

增加一堆模块no_update的处理

BUG Fix

暂时移除delivery升级脚本

改进项目升级脚本

添加针对hr_responsible_id字段的处理

增加auth_signup升级脚本

修复mail_alias上的mail_channel数据
  • Loading branch information
张飞虎 authored and root committed May 30, 2024
1 parent 9279df1 commit 4bf391d
Show file tree
Hide file tree
Showing 33 changed files with 1,825 additions and 91 deletions.
182 changes: 91 additions & 91 deletions docsource/modules160-170.rst

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions openupgrade_scripts/scripts/account/17.0.1.2/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2023 Odoo Community Association (OCA)
# Copyright 2023 Shanghai Yumtown <info@yumtown.com.cn>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade

def update_company(env):
openupgrade.logged_query(
env.cr,
"UPDATE res_company SET invoice_is_download = invoice_is_print;"
)

@openupgrade.migrate()
def migrate(env, version):
openupgrade.load_data(env, "account", "17.0.1.2/noupdate_changes.xml")
update_company(env)
19 changes: 19 additions & 0 deletions openupgrade_scripts/scripts/account/17.0.1.2/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2023 Odoo Community Association (OCA)
# Copyright 2023 Shanghai Yumtown <info@yumtown.com.cn>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade

def update_account_report(env):
openupgrade.logged_query(
env.cr,
"""
ALTER TABLE account_report
ALTER COLUMN filter_account_type TYPE varchar
USING CASE WHEN filter_account_type THEN 'both' ELSE 'disabled' END;
"""
)

@openupgrade.migrate()
def migrate(env, version):
update_account_report(env)
390 changes: 390 additions & 0 deletions openupgrade_scripts/scripts/account/17.0.1.2/upgrade_analysis_work.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
env.ref('auth_signup.reset_password_email').unlink()
17 changes: 17 additions & 0 deletions openupgrade_scripts/scripts/base/17.0.1.3/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2023 Odoo Community Association (OCA)
# Copyright 2023 Shanghai Yumtown <info@yumtown.com.cn>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade


def upadte_ir_property_type(env):
openupgrade.logged_query(
env.cr,
"UPDATE ir_property SET type = 'text' WHERE type = 'html';"
)

@openupgrade.migrate()
def migrate(env, version):
openupgrade.load_data(env, "base", "17.0.1.3/noupdate_changes.xml")
upadte_ir_property_type(env)
217 changes: 217 additions & 0 deletions openupgrade_scripts/scripts/base/17.0.1.3/upgrade_analysis_work.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
---Models in module 'base'---
obsolete model ir.server.object.lines
new model ir.model.inherit
model res.users.settings (moved from mail)
# NOTHING TO DO

---Fields in module 'base'---
base / ir.actions.act_url / target (selection) : selection_keys is now '['download', 'new', 'self']' ('['new', 'self']')
base / ir.actions.act_window / mobile_view_mode (char) : NEW hasdefault: default
base / ir.actions.server / evaluation_type (selection) : NEW selection_keys: ['equation', 'value'], hasdefault: default
base / ir.actions.server / fields_lines (one2many) : DEL relation: ir.server.object.lines
base / ir.actions.server / resource_ref (reference) : NEW
base / ir.actions.server / selection_value (many2one) : NEW relation: ir.model.fields.selection
base / ir.actions.server / state (selection) : selection_keys is now '['code', 'multi', 'object_create', 'object_write', 'webhook']' ('['code', 'multi', 'object_create', 'object_write']')
base / ir.actions.server / update_boolean_value (selection): NEW selection_keys: ['false', 'true'], hasdefault: default
base / ir.actions.server / update_field_id (many2one) : NEW relation: ir.model.fields, hasdefault: compute
base / ir.actions.server / update_m2m_operation (selection): NEW selection_keys: ['add', 'clear', 'remove', 'set'], hasdefault: default
base / ir.actions.server / update_path (char) : NEW hasdefault: default
base / ir.actions.server / update_related_model_id (many2one): NEW relation: ir.model, isfunction: function, stored
base / ir.actions.server / value (text) : NEW
base / ir.actions.server / webhook_field_ids (many2many) : NEW relation: ir.model.fields
base / ir.actions.server / webhook_url (char) : NEW
base / ir.cron / cron_name (char) : not related anymore
base / ir.cron / cron_name (char) : now a function
base / ir.mail_server / _order : _order is now 'sequence, id' ('sequence')
base / ir.mail_server / smtp_authentication (selection): selection_keys is now '['certificate', 'cli', 'login']' ('['certificate', 'login']')
base / ir.model.fields / currency_field (char) : NEW
base / ir.model.fields / sanitize (boolean) : NEW hasdefault: default
base / ir.model.fields / sanitize_attributes (boolean) : NEW hasdefault: default
base / ir.model.fields / sanitize_form (boolean) : NEW hasdefault: default
base / ir.model.fields / sanitize_overridable (boolean): NEW hasdefault: default
base / ir.model.fields / sanitize_style (boolean) : NEW hasdefault: default
base / ir.model.fields / sanitize_tags (boolean) : NEW hasdefault: default
base / ir.model.fields / strip_classes (boolean) : NEW hasdefault: default
base / ir.model.fields / strip_style (boolean) : NEW hasdefault: default
base / ir.model.inherit / model_id (many2one) : NEW relation: ir.model, required
base / ir.model.inherit / parent_field_id (many2one) : NEW relation: ir.model.fields
base / ir.model.inherit / parent_id (many2one) : NEW relation: ir.model, required
# NOTHING TO DO

base / ir.property / type (selection) : selection_keys is now '['binary', 'boolean', 'char', 'date', 'datetime', 'float', 'html', 'integer', 'many2one', 'selection', 'text']' ('['binary', 'boolean', 'char', 'date', 'datetime', 'float', 'integer', 'many2one', 'selection', 'text']')
# DONE: post-migration: upadte_ir_property_type

base / ir.server.object.lines / col1 (many2one) : DEL relation: ir.model.fields, required
base / ir.server.object.lines / evaluation_type (selection) : DEL required, selection_keys: ['equation', 'reference', 'value']
base / ir.server.object.lines / server_id (many2one) : DEL relation: ir.actions.server
base / ir.server.object.lines / value (text) : DEL required
base / ir.ui.view / field_parent (char) : DEL
base / res.company / all_child_ids (one2many) : NEW relation: res.company
base / res.company / base_onboarding_company_state (selection): DEL selection_keys: ['done', 'just_done', 'not_done']
base / res.company / favicon (binary) : DEL attachment: True
base / res.company / parent_path (char) : NEW
base / res.company / uses_default_logo (boolean) : NEW isfunction: function, stored
base / res.country / code (char) : now required
base / res.partner / _order : _order is now 'complete_name ASC, id DESC' ('display_name ASC, id DESC')
base / res.partner / complete_name (char) : NEW isfunction: function, stored
base / res.partner / display_name (char) : not stored anymore
base / res.partner / type (selection) : selection_keys is now '['contact', 'delivery', 'invoice', 'other']' ('['contact', 'delivery', 'invoice', 'other', 'private']')
base / res.users / res_users_settings_id (many2one): previously in module mail
base / res.users / res_users_settings_ids (one2many): previously in module mail
base / res.users.settings / _order : previously in module mail
base / res.users.settings / display_name (char) : previously in module mail
base / res.users.settings / user_id (many2one) : previously in module mail
# NOTHING TO DO

---XML records in module 'base'---
NEW ir.actions.act_window: base.ir_client_actions_report
DEL ir.actions.act_window: base.action_open_base_onboarding_company
DEL ir.actions.client: base.modules_act_cl
DEL ir.actions.client: base.modules_updates_act_cl
DEL ir.actions.server: base.action_server_module_immediate_install
DEL ir.config_parameter: base.icp_mail_bounce_alias (noupdate)
DEL ir.config_parameter: base.icp_mail_catchall_alias (noupdate)
DEL ir.config_parameter: base.icp_mail_default_from (noupdate)
NEW ir.cron: base.ir_cron_res_users_deletion
NEW ir.model.access: base.access_ir_model_inherit
NEW ir.model.access: base.access_res_company_employee
NEW ir.model.access: base.access_res_company_portal
NEW ir.model.access: base.access_res_company_public
NEW ir.model.access: base.access_res_country_employee
NEW ir.model.access: base.access_res_country_group_employee
NEW ir.model.access: base.access_res_country_group_portal
NEW ir.model.access: base.access_res_country_group_public
NEW ir.model.access: base.access_res_country_portal
NEW ir.model.access: base.access_res_country_public
NEW ir.model.access: base.access_res_country_state_employee
NEW ir.model.access: base.access_res_country_state_portal
NEW ir.model.access: base.access_res_country_state_public
NEW ir.model.access: base.access_res_currency_employee
NEW ir.model.access: base.access_res_currency_portal
NEW ir.model.access: base.access_res_currency_public
NEW ir.model.access: base.access_res_currency_rate_employee
NEW ir.model.access: base.access_res_currency_rate_portal
NEW ir.model.access: base.access_res_currency_rate_public
NEW ir.model.access: base.access_res_lang_employee
NEW ir.model.access: base.access_res_lang_group_system
NEW ir.model.access: base.access_res_lang_portal
NEW ir.model.access: base.access_res_lang_public
NEW ir.model.access: base.access_res_users_employee
NEW ir.model.access: base.access_res_users_log_system
NEW ir.model.access: base.access_res_users_portal
NEW ir.model.access: base.access_res_users_public
NEW ir.model.access: base.access_res_users_settings_all [renamed from mail module]
NEW ir.model.access: base.access_res_users_settings_user [renamed from mail module]
DEL ir.model.access: base.access_ir_server_object_lines_group_system
DEL ir.model.access: base.access_res_company_group_user
DEL ir.model.access: base.access_res_country_group_all
DEL ir.model.access: base.access_res_country_group_group_all
DEL ir.model.access: base.access_res_country_state_group_all
DEL ir.model.access: base.access_res_currency_group_all
DEL ir.model.access: base.access_res_currency_rate_group_all
DEL ir.model.access: base.access_res_lang_group_all
DEL ir.model.access: base.access_res_lang_group_user
DEL ir.model.access: base.access_res_users_all
DEL ir.model.access: base.access_res_users_log_all
NEW ir.model.constraint: base.constraint_ir_model_fields_name_manual_field
NEW ir.model.constraint: base.constraint_ir_model_inherit_uniq
NEW ir.model.constraint: base.constraint_res_users_settings_unique_user_id [renamed from mail module]
NEW ir.module.category: base.module_category_services_appointment
NEW ir.module.module: base.module_sale_amazon (noupdate)
NEW ir.rule: base.res_users_settings_rule_admin [renamed from mail module] (noupdate)
NEW ir.rule: base.res_users_settings_rule_user [renamed from mail module] (noupdate)
DEL ir.rule: base.res_partner_rule_private_employee (noupdate)
DEL ir.rule: base.res_partner_rule_private_group (noupdate)
NEW ir.ui.menu: base.menu_ir_client_actions_report
DEL ir.ui.menu: base.menu_board_root
DEL ir.ui.menu: base.menu_module_updates
DEL ir.ui.menu: base.menu_reporting_config
DEL ir.ui.menu: base.menu_reporting_dashboard
DEL ir.ui.menu: base.module_mi
NEW ir.ui.view: base.no_contact
NEW ir.ui.view: base.res_users_identitycheck_view_form
NEW ir.ui.view: base.res_users_identitycheck_view_form_revokedevices
NEW ir.ui.view: base.view_client_action_form
NEW ir.ui.view: base.view_client_action_tree
NEW ir.ui.view: base.view_country_search
DEL ir.ui.view: base.base_onboarding_company_form
DEL ir.ui.view: base.identity_check_wizard
DEL ir.ui.view: base.onboarding_company_step
DEL ir.ui.view: base.onboarding_container
DEL ir.ui.view: base.onboarding_step
DEL ir.ui.view: base.view_module_category_tree
NEW res.country.group: base.eurasian_economic_union (noupdate)
NEW res.country.state: base.state_hk_hk
NEW res.country.state: base.state_hk_kln
NEW res.country.state: base.state_hk_nt
NEW res.country.state: base.state_ke_01
NEW res.country.state: base.state_ke_02
NEW res.country.state: base.state_ke_03
NEW res.country.state: base.state_ke_04
NEW res.country.state: base.state_ke_05
NEW res.country.state: base.state_ke_06
NEW res.country.state: base.state_ke_07
NEW res.country.state: base.state_ke_08
NEW res.country.state: base.state_ke_09
NEW res.country.state: base.state_ke_10
NEW res.country.state: base.state_ke_11
NEW res.country.state: base.state_ke_12
NEW res.country.state: base.state_ke_13
NEW res.country.state: base.state_ke_14
NEW res.country.state: base.state_ke_15
NEW res.country.state: base.state_ke_16
NEW res.country.state: base.state_ke_17
NEW res.country.state: base.state_ke_18
NEW res.country.state: base.state_ke_19
NEW res.country.state: base.state_ke_20
NEW res.country.state: base.state_ke_21
NEW res.country.state: base.state_ke_22
NEW res.country.state: base.state_ke_23
NEW res.country.state: base.state_ke_24
NEW res.country.state: base.state_ke_25
NEW res.country.state: base.state_ke_26
NEW res.country.state: base.state_ke_27
NEW res.country.state: base.state_ke_28
NEW res.country.state: base.state_ke_29
NEW res.country.state: base.state_ke_30
NEW res.country.state: base.state_ke_31
NEW res.country.state: base.state_ke_32
NEW res.country.state: base.state_ke_33
NEW res.country.state: base.state_ke_34
NEW res.country.state: base.state_ke_35
NEW res.country.state: base.state_ke_36
NEW res.country.state: base.state_ke_37
NEW res.country.state: base.state_ke_38
NEW res.country.state: base.state_ke_39
NEW res.country.state: base.state_ke_40
NEW res.country.state: base.state_ke_41
NEW res.country.state: base.state_ke_42
NEW res.country.state: base.state_ke_43
NEW res.country.state: base.state_ke_44
NEW res.country.state: base.state_ke_45
NEW res.country.state: base.state_ke_46
NEW res.country.state: base.state_ke_47
NEW res.country.state: base.state_uy_01
NEW res.country.state: base.state_uy_02
NEW res.country.state: base.state_uy_03
NEW res.country.state: base.state_uy_04
NEW res.country.state: base.state_uy_05
NEW res.country.state: base.state_uy_06
NEW res.country.state: base.state_uy_07
NEW res.country.state: base.state_uy_08
NEW res.country.state: base.state_uy_09
NEW res.country.state: base.state_uy_10
NEW res.country.state: base.state_uy_11
NEW res.country.state: base.state_uy_12
NEW res.country.state: base.state_uy_13
NEW res.country.state: base.state_uy_14
NEW res.country.state: base.state_uy_15
NEW res.country.state: base.state_uy_16
NEW res.country.state: base.state_uy_17
NEW res.country.state: base.state_uy_18
NEW res.country.state: base.state_uy_19
NEW res.currency: base.SLE (noupdate)
DEL res.groups: base.group_private_addresses
NEW res.lang: base.lang_en_NZ
NEW res.lang: base.lang_es_419
# NOTHING TO DO
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2023 Odoo Community Association (OCA)
# Copyright 2023 Shanghai Yumtown <info@yumtown.com.cn>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.load_data(env, "base_automation", "17.0.1.0/noupdate_changes.xml")
10 changes: 10 additions & 0 deletions openupgrade_scripts/scripts/calendar/17.0.1.1/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2023 Odoo Community Association (OCA)
# Copyright 2023 Shanghai Yumtown <info@yumtown.com.cn>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.load_data(env, "calendar", "17.0.1.1/noupdate_changes.xml")
10 changes: 10 additions & 0 deletions openupgrade_scripts/scripts/digest/17.0.1.1/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2023 Odoo Community Association (OCA)
# Copyright 2023 Shanghai Yumtown <info@yumtown.com.cn>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.load_data(env, "digest", "17.0.1.1/noupdate_changes.xml")
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2023 Odoo Community Association (OCA)
# Copyright 2023 Shanghai Yumtown <info@yumtown.com.cn>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.load_data(env, "gamification", "17.0.1.0/noupdate_changes.xml")
10 changes: 10 additions & 0 deletions openupgrade_scripts/scripts/hr/17.0.1.1/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2023 Odoo Community Association (OCA)
# Copyright 2023 Shanghai Yumtown <info@yumtown.com.cn>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.load_data(env, "hr", "17.0.1.1/noupdate_changes.xml")
31 changes: 31 additions & 0 deletions openupgrade_scripts/scripts/hr/17.0.1.1/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2023 Odoo Community Association (OCA)
# Copyright 2023 Shanghai Yumtown <info@yumtown.com.cn>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade


def update_hr_plan_to_mail_activity_plan(env):
openupgrade.logged_query(
env.cr,
"""
UPDATE ir_model_data SET model = 'mail.activity.plan' WHERE module = 'hr' AND model = 'hr.plan';
UPDATE ir_model_data SET model = 'mail.activity.plan.template' WHERE module = 'hr' AND model = 'hr.plan.activity.type';
"""
)


def remove_columns(env):
openupgrade.logged_query(
env.cr,
"""
DELETE FROM ir_model_data WHERE module = 'hr' AND name = 'field_hr_employee__phone';
DELETE FROM ir_model_fields WHERE model = 'hr.employee' AND name = 'phone';
"""
)


@openupgrade.migrate()
def migrate(env, version):
update_hr_plan_to_mail_activity_plan(env)
remove_columns(env)
Loading

0 comments on commit 4bf391d

Please sign in to comment.