diff --git a/openerp/addons/base/migrations/8.0.1.3/openupgrade_analysis_work.txt b/openerp/addons/base/migrations/8.0.1.3/openupgrade_analysis_work.txt index 02da8b841790..84525ef655d1 100644 --- a/openerp/addons/base/migrations/8.0.1.3/openupgrade_analysis_work.txt +++ b/openerp/addons/base/migrations/8.0.1.3/openupgrade_analysis_work.txt @@ -6,41 +6,65 @@ base / ir.actions.report.xml / parser (char) : NEW base / ir.actions.report.xml / report_type (char) : selection_keys is now '['controller', 'pdf', 'qweb-html', 'qweb-pdf', 'sxw', 'webkit']' ('False') base / ir.actions.report.xml / report_type (char) : type is now 'selection' ('char') -# TODO -base / ir.actions.server / copy_object (reference) : DEL -base / ir.actions.server / copyvalue (char) : NEW -base / ir.actions.server / crud_model_id (many2one) : NEW relation: ir.model -base / ir.actions.server / email (char) : DEL +# For the following ir.actions.server changes, OpenUpgrade won't try to manage the values because: +# - ir.actions.server are generally created by system, (re) loading xml files; +# - ir.actions.server has been fully refunded; +# - when doing test, all the following fields are empty when we install modules. (in 7.0 for DEL fields and in 8.0 for NEW fields) +base / ir.actions.server / loop_action (many2one) : DEL relation: ir.actions.server base / ir.actions.server / expression (char) : DEL +base / ir.actions.server / trigger_name (selection) : DEL selection_keys: function +base / ir.actions.server / copyvalue (char) : NEW base / ir.actions.server / id_object (reference) : NEW base / ir.actions.server / id_value (char) : NEW -base / ir.actions.server / link_field_id (many2one) : NEW relation: ir.model.fields base / ir.actions.server / link_new_record (boolean) : NEW -base / ir.actions.server / loop_action (many2one) : DEL relation: ir.actions.server base / ir.actions.server / menu_ir_values_id (many2one) : NEW relation: ir.values -base / ir.actions.server / message (text) : DEL -base / ir.actions.server / mobile (char) : DEL base / ir.actions.server / model_object_field (many2one) : NEW relation: ir.model.fields -base / ir.actions.server / record_id (many2one) : DEL relation: ir.model.fields -base / ir.actions.server / ref_object (reference) : NEW +base / ir.actions.server / sub_model_object_field (many2one): NEW relation: ir.model.fields +base / ir.actions.server / sub_object (many2one) : NEW relation: ir.model + +# The feature of 'email', 'sms', 'mobile', has been removed. --> Nothing to do. +base / ir.actions.server / email (char) : DEL base / ir.actions.server / sms (char) : DEL +base / ir.actions.server / mobile (char) : DEL +base / ir.actions.server / message (text) : DEL + +# 'srcmodel_id' renamed into 'crud_model_id'. oldname feature is used. --> Nothing to do. base / ir.actions.server / srcmodel_id (many2one) : DEL relation: ir.model +base / ir.actions.server / crud_model_id (many2one) : NEW relation: ir.model +# 'trigger_obj_id' renamed into 'wkf_field_id'. oldname feature is used. --> Nothing to do. +base / ir.actions.server / trigger_obj_id (many2one) : DEL relation: ir.model.fields +base / ir.actions.server / wkf_field_id (many2one) : NEW relation: ir.model.fields +# 'copy_object' renamed into 'ref_object'. oldname feature is used. --> Nothing to do. +base / ir.actions.server / copy_object (reference) : DEL +base / ir.actions.server / ref_object (reference) : NEW +# 'record_id' renamed into 'link_field_id'. oldname feature is used. --> Nothing to do. +base / ir.actions.server / record_id (many2one) : DEL relation: ir.model.fields +base / ir.actions.server / link_field_id (many2one) : NEW relation: ir.model.fields +# 'write_id' renamed into 'write_expression'. oldname feature is used. --> Nothing to do. +base / ir.actions.server / write_id (char) : DEL +base / ir.actions.server / write_expression (char) : NEW + +# 'state' was a selection field and become a selection field defined by a function (_get_states) +# 'dummy', 'email', 'loop', 'object_copy', 'other', 'sms' values has been deleted; +# 'multi' is new. +# OpenUpgrade will test and warn if there is invalid values in this field. calling _get_states in post-migration script--> DONE. base / ir.actions.server / state (selection) : selection_keys is now 'function' ('['client_action', 'code', 'dummy', 'email', 'loop', 'object_copy', 'object_create', 'object_write', 'other', 'sms', 'trigger']') -base / ir.actions.server / sub_model_object_field (many2one): NEW relation: ir.model.fields -base / ir.actions.server / sub_object (many2one) : NEW relation: ir.model + +# Field is move to a upper-level module. We assume that the field will not be used in previous version if 'email_template' is not installed. --> Nothing to do. base / ir.actions.server / subject (char) : module is now 'email_template' ('base') base / ir.actions.server / subject (char) : now a function -base / ir.actions.server / trigger_name (selection) : DEL selection_keys: function -base / ir.actions.server / trigger_obj_id (many2one) : DEL relation: ir.model.fields + +# New feature for ir.actions.server : using default value is OK. --> Nothing to do. base / ir.actions.server / use_create (selection) : NEW required: required, selection_keys: ['copy_current', 'copy_other', 'new', 'new_other'], req_default: new +# New feature for ir.actions.server : using default value is OK. --> Nothing to do. base / ir.actions.server / use_relational_model (selection): NEW required: required, selection_keys: ['base', 'relational'], req_default: base +# New feature for ir.actions.server : using default value is OK. --> Nothing to do. base / ir.actions.server / use_write (selection) : NEW required: required, selection_keys: ['current', 'expression', 'other'], req_default: current -base / ir.actions.server / wkf_field_id (many2one) : NEW relation: ir.model.fields + +# New feature, nothing to do. base / ir.actions.server / wkf_transition_id (many2one) : NEW relation: workflow.transition -base / ir.actions.server / write_expression (char) : NEW -base / ir.actions.server / write_id (char) : DEL -# TODO +# New model 'ir.logging' associated to a new feature. --> Nothing to do. base / ir.logging / create_date (datetime) : NEW base / ir.logging / create_uid (integer) : NEW base / ir.logging / dbname (char) : NEW @@ -52,12 +76,14 @@ base / ir.logging / name (char) : NEW re base / ir.logging / path (char) : NEW required: required base / ir.logging / type (selection) : NEW required: required, selection_keys: ['client', 'server'] -# TODO +# 'view_load' concept has been removed. redundant because the value was true only on properties fields. --> Nothing to do. base / ir.model.fields / view_load (boolean) : DEL -# TODO +# field changed from 'reference' to 'char' but the storage is identical. --> Nothing to do. base / ir.property / res_id (reference) : type is now 'char' ('reference') +# New option. --> Nothing to do. base / ir.property / type (selection) : selection_keys is now '['binary', 'boolean', 'char', 'date', 'datetime', 'float', 'integer', 'many2one', 'selection', 'text']' ('['binary', 'boolean', 'char', 'date', 'datetime', 'float', 'integer', 'many2one', 'text']') +# field changed from 'reference' to 'char' but the storage is identical. --> Nothing to do. base / ir.property / value_reference (reference) : type is now 'char' ('reference') # New feature for ir.ui.view that allow enable or disable inheritance : using default value is OK. --> Nothing to do. @@ -66,18 +92,23 @@ base / ir.ui.view / application (selection) : NEW re base / ir.ui.view / create_date (datetime) : NEW # new one2many field on an existing many2one field (ir_ui_view.inherit_id). --> Nothing to do. base / ir.ui.view / inherit_children_ids (one2many): NEW relation: ir.ui.view +# New feature for ir.ui.view : using default value is OK. --> Nothing to do. base / ir.ui.view / mode (selection) : NEW required: required, selection_keys: ['extension', 'primary'], req_default: primary # new one2many field on an existing many2one field (ir_model_data.res_id). --> Nothing to do. base / ir.ui.view / model_ids (one2many) : NEW relation: ir.model.data +# function -> selection. Nothing to do. base / ir.ui.view / type (selection) : not a function anymore +# removed value : 'mdx'. unused in addons. OpenUpgrade will test if extra-addons doesnt use this value. Done. +# new value : 'qweb'. --> Nothing to do. base / ir.ui.view / type (selection) : selection_keys is now '['calendar', 'diagram', 'form', 'gantt', 'graph', 'kanban', 'qweb', 'search', 'tree']' ('['calendar', 'diagram', 'form', 'gantt', 'graph', 'kanban', 'mdx', 'search', 'tree']') # 'write_date' was already present in V7 but not in the model. --> Nothing to do. base / ir.ui.view / write_date (datetime) : NEW + # New feature: using default value is OK. --> Nothing to do. base / res.company / font (many2one) : NEW relation: res.font -# 'paper_format' renamed into 'rml_paper_format'. --> DONE. +# 'paper_format' renamed into 'rml_paper_format'. oldname feature is used. --> Nothing to do. base / res.company / paper_format (selection) : DEL required: required, selection_keys: ['a4', 'us_letter'], req_default: a4 base / res.company / rml_paper_format (selection) : NEW required: required, selection_keys: ['a4', 'us_letter'], req_default: a4 @@ -96,7 +127,7 @@ base / res.font / path (char) : NEW re # The feature has been removed. It gaves the possibility to a user to have a different menu as the default one. --> Nothing to do. base / res.users / menu_id (many2one) : DEL relation: ir.actions.actions -# TODO +# This field is new in the model but not in Database. It was created by the 7.0 script in server/openerp/addons/base/base.sql .--> Nothing to do. base / workflow.instance / transition_ids (many2many) : NEW relation: workflow.transition diff --git a/openerp/addons/base/migrations/8.0.1.3/post-migration.py b/openerp/addons/base/migrations/8.0.1.3/post-migration.py new file mode 100644 index 000000000000..3c1f0e7634b1 --- /dev/null +++ b/openerp/addons/base/migrations/8.0.1.3/post-migration.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenUpgrade module for Odoo +# @copyright 2014-Today: Odoo Community Association +# @author: Sylvain LE GAL +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import logging +from openerp import pooler, SUPERUSER_ID +from openerp.openupgrade import openupgrade +logger = logging.getLogger('OpenUpgrade') + + +def check_ir_actions_server_state(cr, pool): + """Test if 'state' values are correct. + If not, log an error to indicate that the user has to overload _get_state + function in his custom modules.""" + ias_obj = pool['ir.actions.server'] + valid_selection = ias_obj._get_states(cr, SUPERUSER_ID) + valid_list = [x[0] for x in valid_selection] + ias_ids = ias_obj.search( + cr, SUPERUSER_ID, [('state', 'not in', valid_list)]) + for ias in ias_obj.browse(cr, SUPERUSER_ID, ias_ids): + logger.error( + "Invalid value '%s' in the model 'ir_actions_server' " + "for the field 'state'. (id %s).Please overload the new " + "ir_actions_server._get_state function." % ( + ias.state, ias.id)) + + +@openupgrade.migrate() +def migrate(cr, version): + pool = pooler.get_pool(cr.dbname) + check_ir_actions_server_state(cr, pool) diff --git a/openerp/addons/base/migrations/8.0.1.3/pre-migration.py b/openerp/addons/base/migrations/8.0.1.3/pre-migration.py index 3f5a7035fd25..d08728aa188b 100644 --- a/openerp/addons/base/migrations/8.0.1.3/pre-migration.py +++ b/openerp/addons/base/migrations/8.0.1.3/pre-migration.py @@ -22,15 +22,12 @@ from openerp.openupgrade import openupgrade -column_renames = { - 'res_company': [ - ('paper_format', 'rml_paper_format'), - ] -} - @openupgrade.migrate() def migrate(cr, version): openupgrade.check_values_selection_field( cr, 'ir_act_report_xml', 'report_type', ['controller', 'pdf', 'qweb-html', 'qweb-pdf', 'sxw', 'webkit']) - openupgrade.rename_columns(cr, column_renames) + openupgrade.check_values_selection_field( + cr, 'ir_ui_view', 'type', [ + 'calendar', 'diagram', 'form', 'gantt', 'graph', 'kanban', + 'qweb', 'search', 'tree'])