Skip to content

Commit

Permalink
[MIG][14.0] Base
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanRijnhart committed Dec 16, 2020
1 parent abc0d67 commit 11c8e61
Show file tree
Hide file tree
Showing 4 changed files with 249 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
<record id="jp" model="res.country">
<field name="state_required">1</field>
</record>
<record id="main_partner" model="res.partner">
<!-- record id="main_partner" model="res.partner">
<field name="company_id" eval="None"/>
<field name="email"/>
<field name="website"/>
</record>
</record -->
<record id="mk" model="res.country">
<field name="name">North Macedonia</field>
</record>
Expand Down Expand Up @@ -76,9 +76,9 @@
<field name="state_required">1</field>
<field name="vat_label">EIN</field>
</record>
<record id="user_admin" model="res.users">
<!-- record id="user_admin" model="res.users">
<field name="image_1920" type="base64" file="base/static/img/avatar_grey.png"/>
</record>
</record -->
<record id="vn" model="res.country">
<field name="zip_required">0</field>
</record>
Expand Down
10 changes: 10 additions & 0 deletions openupgrade_scripts/scripts/base/14.0.1.3/post-migrate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2020 Odoo Community Association (OCA)
# Copyright 2020 Opener B.V. <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
# Load noupdate changes
openupgrade.load_data(env.cr, "base", "14.0.1.3/noupdate_changes.xml")
112 changes: 112 additions & 0 deletions openupgrade_scripts/scripts/base/14.0.1.3/pre-migrate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Copyright 2020 Odoo Community Association (OCA)
# Copyright 2020 Opener B.V. <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import logging

from openupgradelib import openupgrade

from odoo import tools

_logger = logging.getLogger(__name__)

try:
from odoo.addons.openupgrade_scripts.apriori import merged_modules, renamed_modules
except ImportError:
renamed_modules = {}
merged_modules = {}
_logger.warn(
"You are using openupgrade_framework without having"
" openupgrade_scripts module available."
" The upgrade process will not work properly."
)


xmlid_renames = [
# Module category renames were not detected by the analyze. These records
# are created on the fly when intializing a new database in
# odoo/modules/db.py
(
"base.module_category_accounting_expenses",
"base.module_category_human_resources_expenses",
),
("base.module_category_discuss", "base.module_category_productivity_discuss"),
(
"base.module_category_localization_account_charts",
"base.module_category_accounting_localizations_account_charts",
),
("base.module_category_marketing_survey", "base.module_category_marketing_surveys"),
(
"base.module_category_operations_helpdesk",
"base.module_category_services_helpdesk",
),
(
"base.module_category_operations_inventory",
"base.module_category_inventory_inventory",
),
(
"base.module_category_operations_inventory_delivery",
"base.module_category_inventory_delivery",
),
(
"base.module_category_operations_maintenance",
"base.module_category_manufacturing_maintenance",
),
(
"base.module_category_operations_project",
"base.module_category_services_project",
),
(
"base.module_category_operations_purchase",
"base.module_category_inventory_purchase",
),
(
"base.module_category_operations_timesheets",
"base.module_category_services_timesheets",
),
]


@openupgrade.migrate(use_env=False)
def migrate(cr, version):
"""
Don't request an env for the base pre migration as flushing the env in
odoo/modules/registry.py will break on the 'base' module not yet having
been instantiated.
"""
if "openupgrade_framework" not in tools.config["server_wide_modules"]:
logging.error(
"openupgrade_framework is not preloaded. You are highly "
"recommended to run the Odoo with --load=openupgrade_framework "
"when migrating your database."
)
# Rename xmlids
openupgrade.rename_xmlids(cr, xmlid_renames)
# Update ir_model_data timestamps from obsolete columns
openupgrade.logged_query(
cr,
"""
UPDATE ir_model_data
SET create_date = COALESCE(date_init, create_date),
write_date = COALESCE(date_update, write_date)
WHERE (create_date IS NULL OR write_date IS NULL) AND
(date_init IS NOT NULL OR date_update IS NOT NULL)
""",
)
# Set default values from odoo/addons/base/data/base_data.sql
cr.execute(
""" ALTER TABLE ir_model_data
ALTER COLUMN create_date
SET DEFAULT NOW() AT TIME ZONE 'UTC',
ALTER COLUMN write_date
SET DEFAULT NOW() AT TIME ZONE 'UTC'
"""
)
# Perform module renames and merges
openupgrade.update_module_names(cr, renamed_modules.items())
openupgrade.update_module_names(cr, merged_modules.items(), merge_modules=True)

# Migrate partners from Fil to Tagalog
# See https://github.com/odoo/odoo/commit/194ed76c5cc9
openupgrade.logged_query(
cr, "UPDATE res_partner SET lang = 'tl_PH' WHERE lang = 'fil_PH'"
)
123 changes: 123 additions & 0 deletions openupgrade_scripts/scripts/base/14.0.1.3/upgrade_analysis_work.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---Models in module 'base'---
model base.document.layout (moved to web) [transient]
new model ir.qweb.field.image_url [abstract]
new model res.users.apikeys [sql_view]
new model res.users.apikeys.description [transient]
new model res.users.apikeys.show [abstract]
new model res.users.identitycheck [transient]
# Nothing to do
---Fields in module 'base'---
base / ir.model / order (char) : NEW required, req_default: function, hasdefault
# Populated during model reflection
base / ir.model.data / date_init (datetime) : DEL
base / ir.model.data / date_update (datetime) : DEL
# Done: migrate values and set defaults from odoo/addons/base/data/base_data.sql
base / ir.model.data / res_id (integer) : relation is now 'model' ('False') [nothing to do]
base / ir.model.data / res_id (integer) : type is now 'many2one_reference' ('integer')
# Syntactic sugar of the Many2oneReference field
base / ir.model.fields / copied (boolean) : now a function
# Nothing to do. Default/onchange method added
base / ir.model.fields / group_expand (boolean) : NEW
# Nothing to do. Exposure of this field level option for manual fields
base / ir.ui.view / model_ids (one2many) : DEL relation: ir.model.data
# Nothing to do. Related mechanism (in get_inheriting_views_arch) now implemented with subquery
base / ir.ui.view / type (selection) : selection_keys is now '['calendar', 'form', 'gantt', 'graph', 'kanban', 'pivot', 'qweb', 'search', 'tree']' ('['calendar', 'diagram', 'form', 'gantt', 'graph', 'kanban', 'pivot', 'qweb', 'search', 'tree']')
# Nothing to do: Related to the removal of unused web_diagram module
base / report.layout / sequence (integer) : NEW hasdefault
# Nothing to do. Value is set when loading the report.layout data records
base / res.company / account_no (char) : DEL
# Nothing to do. Unused field
base / res.country / image (binary) : DEL attachment: True
# Flag image is now rendered from URL, loaded with noupdate data
base / res.country / state_required (boolean) : NEW hasdefault
base / res.country / zip_required (boolean) : NEW hasdefault
# Values loaded with noupdate data
base / res.currency.rate / currency_id (many2one) : now required
# Nothing to do. Expect all records to have a currency.
base / res.lang / flag_image (binary) : NEW attachment: True
# Nothing to do. New option to assign a flag image to a language that is different from the country flag
base / res.partner / barcode (char) : previously in module point_of_sale
# Nothing to do. Barcode can also be used to identify a contact in base.
base / res.partner.bank / active (boolean) : NEW hasdefault
# Done: merged oca/contact/partner_bank_active into base
base / res.users / api_key_ids (one2many) : NEW relation: res.users.apikeys
base / res.users / barcode (char) : previously in module hr
# Nothing to do. See res.partner's barcode field.
---XML records in module 'base'---
NEW ir.actions.act_window: base.action_apikeys_admin
NEW ir.actions.act_window: base.action_res_users_keys_description
DEL ir.actions.act_window: base.action_base_document_layout_configurator [renamed to web module]
DEL ir.actions.act_window: base.action_partner_employee_form
DEL ir.actions.act_window: base.action_partner_other_form
DEL ir.actions.act_window: base.company_normal_action_tree
NEW ir.model.access: base.access_base_language_export
NEW ir.model.access: base.access_base_language_import
NEW ir.model.access: base.access_base_language_install
NEW ir.model.access: base.access_base_module_uninstall
NEW ir.model.access: base.access_base_module_update
NEW ir.model.access: base.access_base_module_upgrade
NEW ir.model.access: base.access_base_partner_merge_automatic_wizard
NEW ir.model.access: base.access_base_partner_merge_line
NEW ir.model.access: base.access_base_update_translations
NEW ir.model.access: base.access_change_password_user
NEW ir.model.access: base.access_change_password_wizard
NEW ir.model.access: base.access_ir_demo
NEW ir.model.access: base.access_ir_demo_failure
NEW ir.model.access: base.access_ir_demo_failure_wizard
NEW ir.model.access: base.access_ir_property_group_system
NEW ir.model.access: base.access_res_config
NEW ir.model.access: base.access_res_config_installer
NEW ir.model.access: base.access_res_config_settings
NEW ir.model.access: base.access_res_country_group_system
NEW ir.model.access: base.access_res_users_apikeys_access_employee
NEW ir.model.access: base.access_res_users_apikeys_access_portal
NEW ir.model.access: base.access_res_users_apikeys_description_employee
NEW ir.model.access: base.access_res_users_apikeys_description_portal
NEW ir.model.access: base.access_res_users_apikeys_show_employee
NEW ir.model.access: base.access_res_users_identitycheck_employee
NEW ir.model.access: base.access_res_users_identitycheck_portal
NEW ir.model.access: base.access_reset_view_arch_wizard
NEW ir.model.access: base.access_reset_view_arch_wizard_group_system
NEW ir.model.access: base.access_wizard_ir_model_menu_create
DEL ir.model.access: base.access_ir_actions_act_url_all
DEL ir.model.access: base.access_ir_actions_act_window_all
DEL ir.model.access: base.access_ir_actions_act_window_close_all
DEL ir.model.access: base.access_ir_actions_act_window_view_all
DEL ir.model.access: base.access_ir_actions_all
DEL ir.model.access: base.access_ir_actions_report_all
DEL ir.model.access: base.access_ir_actions_server_all
DEL ir.model.access: base.access_ir_property_group_user_manager
DEL ir.model.access: base.access_ir_server_object_lines_all
NEW ir.module.category: base.module_category_accounting (noupdate)
NEW ir.module.category: base.module_category_accounting_localizations (noupdate)
NEW ir.module.category: base.module_category_accounting_localizations_account_charts (noupdate)
NEW ir.module.category: base.module_category_customizations
NEW ir.module.category: base.module_category_inventory (noupdate)
NEW ir.module.category: base.module_category_productivity (noupdate)
NEW ir.module.category: base.module_category_services (noupdate)
NEW ir.module.category: base.module_category_services_helpdesk
DEL ir.module.category: base.module_category_localization (noupdate)
DEL ir.module.category: base.module_category_localization_account_charts
DEL ir.module.category: base.module_category_operations (noupdate)
DEL ir.module.category: base.module_category_operations_helpdesk
NEW ir.module.module: base.module_planning (noupdate)
DEL ir.module.module: base.module_project_forecast (noupdate)
NEW ir.rule: base.api_key_admin (noupdate)
NEW ir.rule: base.api_key_public (noupdate)
NEW ir.rule: base.api_key_user (noupdate)
NEW ir.rule: base.change_password_rule (noupdate)
NEW ir.rule: base.res_users_identity_check (noupdate)
NEW ir.ui.view: base.form_res_users_key_description
NEW ir.ui.view: base.form_res_users_key_show
NEW ir.ui.view: base.identity_check_wizard
NEW ir.ui.view: base.view_apikeys
NEW ir.ui.view: base.view_model_constraint_search
DEL ir.ui.view: base.layout_preview
DEL ir.ui.view: base.view_base_document_layout
DEL ir.ui.view: base.view_menu
DEL ir.ui.view: base.view_partner_short_form
NEW res.country.group: base.sepa_zone (noupdate)
NEW res.groups: base.group_allow_export
NEW res.lang: base.lang_en_IN
DEL res.lang: base.lang_fil
# Done: switch partners to Tagalog

0 comments on commit 11c8e61

Please sign in to comment.