-
Notifications
You must be signed in to change notification settings - Fork 0
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
[MIG][14.0] Base #4
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"__comment__": "Renamed modules is a mapping from old module name to new module name", | ||
"renamed_modules": {}, | ||
"__comment__": "Merged modules contain a mapping from old module names to other, preexisting module names", | ||
"merged_modules": { | ||
"partner_bank_active": "base" | ||
}, | ||
"__comment__": "The members below are only used to help the analysis process", | ||
"renamed_models": {}, | ||
"merged_models": {} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?xml version='1.0' encoding='utf-8' ?> | ||
<odoo> | ||
<record id="ao" model="res.country"> | ||
<field name="zip_required">0</field> | ||
</record> | ||
<record id="ar" model="res.country"> | ||
<field name="state_required">1</field> | ||
</record> | ||
<record id="bj" model="res.country"> | ||
<field name="zip_required">0</field> | ||
</record> | ||
<record id="bz" model="res.country"> | ||
<field name="zip_required">0</field> | ||
</record> | ||
<record id="ca" model="res.country"> | ||
<field name="state_required">1</field> | ||
</record> | ||
<record id="default_user" model="res.users"> | ||
<field | ||
name="groups_id" | ||
eval="[(4, ref('base.group_partner_manager')), (4, ref('base.group_allow_export'))]" | ||
/> | ||
</record> | ||
<record id="hk" model="res.country"> | ||
<field name="zip_required">0</field> | ||
</record> | ||
<record id="id" model="res.country"> | ||
<field name="state_required">1</field> | ||
</record> | ||
<record id="ie" model="res.country"> | ||
<field name="zip_required">0</field> | ||
</record> | ||
<record id="it" model="res.country"> | ||
<field name="state_required">1</field> | ||
</record> | ||
<record id="jp" model="res.country"> | ||
<field name="state_required">1</field> | ||
</record> | ||
<!-- record id="main_partner" model="res.partner"> | ||
<field name="company_id" eval="None"/> | ||
<field name="email"/> | ||
<field name="website"/> | ||
</record --> | ||
<record id="mk" model="res.country"> | ||
<field name="name">North Macedonia</field> | ||
</record> | ||
<record id="mo" model="res.country"> | ||
<field name="zip_required">0</field> | ||
</record> | ||
<record id="mx" model="res.country"> | ||
<field name="state_required">1</field> | ||
</record> | ||
<record id="paperformat_euro" model="report.paperformat"> | ||
<field name="margin_bottom">32</field> | ||
</record> | ||
<record id="paperformat_us" model="report.paperformat"> | ||
<field name="margin_bottom">30</field> | ||
</record> | ||
<!-- record id="res_partner_bank_rule" model="ir.rule"> | ||
<field name="global"/> | ||
</record--> | ||
<record id="res_partner_rule_private_employee" model="ir.rule"> | ||
<field name="perm_create" eval="True" /> | ||
<field name="perm_unlink" eval="True" /> | ||
<field name="perm_write" eval="True" /> | ||
</record> | ||
<record id="res_partner_rule_private_group" model="ir.rule"> | ||
<field name="perm_create" eval="True" /> | ||
<field name="perm_unlink" eval="True" /> | ||
<field name="perm_write" eval="True" /> | ||
</record> | ||
<record id="us" model="res.country"> | ||
<field name="state_required">1</field> | ||
<field name="vat_label">EIN</field> | ||
</record> | ||
<record id="vn" model="res.country"> | ||
<field name="zip_required">0</field> | ||
</record> | ||
</odoo> |
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") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# 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__) | ||
|
||
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 | ||
apriori = openupgrade._load_apriori() | ||
openupgrade.update_module_names(cr, apriori.renamed_modules.items()) | ||
openupgrade.update_module_names( | ||
cr, apriori.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'" | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
---Models in module 'base'--- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that we're in the works of refactoring and all that stuff, I have to tell you something: I hate the syntax of these files. Couldn't we just have a YAML, which supports proper comments and syntax highlighting, and besides allows automated parsing to check migration completion status? Or even a CSV... but not this please 🙈 (Note: of course just a personal preference and absolutely not important. But really, this is awful 😆) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @yajo. Well it's a distinct point. You're probably right. But it requires a big extra work. Feel free to make a PR against upgrade_analysis module, that is responsible of the generation of the files. |
||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yikes! those
__comment__
... 🙈Just use other format. 🤷♂️ See legalsylvain/server-tools#4 (review).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine by me.