Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions addons/event/migrations/8.0.0.1/openupgrade_analysis_work.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---Fields in module 'event'---
event / event.event / date_tz (selection) : NEW selection_keys: function
event / event.event / description (html) : NEW
# Converted 'note' value to HTML

event / event.event / main_speaker_id (many2one) : DEL relation: res.partner
event / event.event / message_last_post (datetime) : NEW
# Used set_message_last_post()

event / event.event / note (text) : DEL
# Fields argument 'oldname' used, now points to 'description' field

event / event.event / organizer_id (many2one) : NEW relation: res.partner
event / event.event / register_max (integer) : DEL
# Fields argument 'oldname' used, now points to 'seats_max' field

event / event.event / register_min (integer) : DEL
# Fields argument 'oldname' used, now points to 'seats_min' field

event / event.event / seats_max (integer) : NEW
event / event.event / seats_min (integer) : NEW
event / event.event / speaker_confirmed (boolean) : DEL
event / event.registration / message_last_post (datetime) : NEW
# Used set_message_last_post()

event / report.event.registration / event_date (char) : type is now 'datetime' ('char')
event / report.event.registration / month (selection) : DEL selection_keys: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
event / report.event.registration / register_max (integer) : DEL
event / report.event.registration / seats_max (integer) : NEW
event / report.event.registration / speaker_id (many2one) : DEL relation: res.partner
event / report.event.registration / year (char) : DEL
event / res.partner / event_ids (one2many) : DEL relation: event.event
event / res.partner / event_registration_ids (one2many): DEL relation: event.registration
---XML records in module 'event'---
DEL ir.actions.act_window: event.act_event_reg
DEL ir.actions.act_window: event.act_event_view
DEL ir.actions.act_window: event.act_event_view_registration
DEL ir.actions.act_window: event.open_board_associations_manager
DEL ir.actions.act_window.view: event.action_report_event_registration_tree
NEW ir.rule: event.event_event_company_rule
NEW ir.rule: event.event_registration_company_rule
NEW ir.rule: event.report_event_registration_company_rule
DEL ir.rule: event.event_event_comp_rule
DEL ir.rule: event.event_registration_comp_rule
DEL ir.rule: event.report_event_registration_comp_rule
NEW ir.ui.menu: event.event_configuration
DEL ir.ui.menu: base.menu_event_main
DEL ir.ui.menu: event.menu_board_associations_manager
NEW ir.ui.view: event.assets_backend
DEL ir.ui.view: event.board_associations_manager_form
DEL ir.ui.view: event.report_event_registration_tree
DEL ir.ui.view: event.view_report_event_reg_graph
# Nothing to do
34 changes: 34 additions & 0 deletions addons/event/migrations/8.0.0.1/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 HBEE (http://www.hbee.eu)
# @author: Paulius Sladkevičius <paulius@hbee.eu>
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################

from openerp import pooler, SUPERUSER_ID
from openerp.openupgrade.openupgrade import (migrate, convert_field_to_html,
get_legacy_name)
from openerp.openupgrade.openupgrade_80 import set_message_last_post


@migrate()
def migrate(cr, version):
pool = pooler.get_pool(cr.dbname)
set_message_last_post(
cr, SUPERUSER_ID, pool, ['event.event', 'event.registration'])
convert_field_to_html(cr, 'event_event', get_legacy_name('note'),
'description')
33 changes: 33 additions & 0 deletions addons/event/migrations/8.0.0.1/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 HBEE (http://www.hbee.eu)
# @author: Paulius Sladkevičius <paulius@hbee.eu>
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################

from openerp.openupgrade import openupgrade

column_renames = {
'event_event': [
('note', None),
],
}


@openupgrade.migrate()
def migrate(cr, version):
openupgrade.rename_columns(cr, column_renames)
2 changes: 1 addition & 1 deletion openerp/openupgrade/doc/source/modules70-80.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Status :
+-----------------------------------+-----------------------------------+
|email_template | Done |
+-----------------------------------+-----------------------------------+
|event | |
|event |Done |
+-----------------------------------+-----------------------------------+
|event_sale | |
+-----------------------------------+-----------------------------------+
Expand Down
21 changes: 21 additions & 0 deletions openerp/openupgrade/openupgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import logging
from openerp import release, tools, SUPERUSER_ID
from openerp.osv import orm
from openerp.tools.mail import plaintext2html
import openupgrade_tools

# The server log level has not been set at this point
Expand Down Expand Up @@ -56,6 +57,7 @@
'message',
'check_values_selection_field',
'move_field_m2o',
'convert_field_to_html',
]


Expand Down Expand Up @@ -704,3 +706,22 @@ def default_func(cr, pool, id, vals):
pool[registry_new_model].write(
cr, SUPERUSER_ID, [ko_id],
{field_new_model: value})


def convert_field_to_html(cr, table, field_name, html_field_name):
"""
Convert field value to HTML value.
"""
cr.execute(
"SELECT id, %(field)s FROM %(table)s WHERE %(field)s IS NOT NULL" % {
'field': field_name,
'table': table,
}
)
for row in cr.fetchall():
logged_query(
cr, "UPDATE %(table)s SET %(field)s = %s WHERE id = %s" % {
'field': html_field_name,
'table': table,
}, (plaintext2html(row[1]), row[0])
)