diff --git a/docsource/modules140-150.rst b/docsource/modules140-150.rst index e09ebefd5191..92b8129cba56 100644 --- a/docsource/modules140-150.rst +++ b/docsource/modules140-150.rst @@ -98,7 +98,7 @@ Module coverage 14.0 -> 15.0 +-------------------------------------------------+----------------------+-------------------------------------------------+ | bus | Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ -| calendar | | | +| calendar | Done | | +-------------------------------------------------+----------------------+-------------------------------------------------+ | calendar_sms | | | +-------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/calendar/15.0.1.1/post-migration.py b/openupgrade_scripts/scripts/calendar/15.0.1.1/post-migration.py new file mode 100644 index 000000000000..7685c67a39e2 --- /dev/null +++ b/openupgrade_scripts/scripts/calendar/15.0.1.1/post-migration.py @@ -0,0 +1,15 @@ +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data(env.cr, "calendar", "15.0.1.1/noupdate_changes.xml") + openupgrade.delete_record_translations( + env.cr, + "calendar", + [ + "calendar_template_meeting_changedate", + "calendar_template_meeting_invitation", + "calendar_template_meeting_reminder", + ], + ) diff --git a/openupgrade_scripts/scripts/calendar/15.0.1.1/pre-migration.py b/openupgrade_scripts/scripts/calendar/15.0.1.1/pre-migration.py new file mode 100644 index 000000000000..1c9a92bacae7 --- /dev/null +++ b/openupgrade_scripts/scripts/calendar/15.0.1.1/pre-migration.py @@ -0,0 +1,61 @@ +from openupgradelib import openupgrade + +_model_renames = [ + ("calendar.contacts", "calendar.filters"), +] + +_table_renamed = [ + ("calendar_contacts", "calendar_filters"), +] + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.delete_sql_constraint_safely( + env, "calendar", "calendar_contacts", "user_id_partner_id_unique" + ) + # we delete sql constraint before table rename + openupgrade.rename_models(env.cr, _model_renames) + openupgrade.rename_tables(env.cr, _table_renamed) + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE calendar_filters + ADD COLUMN IF NOT EXISTS partner_checked BOOLEAN; + UPDATE calendar_filters + SET partner_checked = TRUE; + """, + ) + openupgrade.convert_field_to_html( + env.cr, "calendar_event", "description", "description" + ) + openupgrade.rename_fields( + env, + [ + ("calendar.recurrence", "calendar_recurrence", "fr", "fri"), + ("calendar.recurrence", "calendar_recurrence", "mo", "mon"), + ("calendar.recurrence", "calendar_recurrence", "sa", "sat"), + ("calendar.recurrence", "calendar_recurrence", "su", "sun"), + ("calendar.recurrence", "calendar_recurrence", "th", "thu"), + ("calendar.recurrence", "calendar_recurrence", "tu", "tue"), + ("calendar.recurrence", "calendar_recurrence", "we", "wed"), + ], + ) + # change the value of 'weekday' in the calendar_recurrence table + openupgrade.logged_query( + env.cr, + """ + UPDATE calendar_recurrence + SET weekday = CASE WHEN weekday = 'FR' THEN 'FRI' + WHEN weekday = 'MO' THEN 'MON' + WHEN weekday = 'SA' THEN 'SAT' + WHEN weekday = 'SU' THEN 'SUN' + WHEN weekday = 'TH' THEN 'THU' + WHEN weekday = 'TU' THEN 'TUE' + WHEN weekday = 'WE' THEN 'WED' + END + WHERE weekday IN ('FR', 'MO', 'SA', 'SU', 'TH', 'TU', 'WE')""", + ) + openupgrade.delete_sql_constraint_safely( + env, "calendar", "calendar_recurrence", "month_day" + ) diff --git a/openupgrade_scripts/scripts/calendar/15.0.1.1/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/calendar/15.0.1.1/upgrade_analysis_work.txt new file mode 100644 index 000000000000..fa60ff7b3933 --- /dev/null +++ b/openupgrade_scripts/scripts/calendar/15.0.1.1/upgrade_analysis_work.txt @@ -0,0 +1,81 @@ +---Models in module 'calendar'--- +obsolete model calendar.contacts (renamed to calendar.filters) +new model calendar.filters (renamed from calendar.contacts) +# DONE: pre-migration: renamed model 'calendar.contacts' to 'calendar.filters', renamed table 'calendar_contacts' to 'calendar_filters' + +---Fields in module 'calendar'--- +calendar / calendar.alarm / body (text) : NEW +calendar / calendar.alarm / mail_template_id (many2one) : NEW relation: mail.template, isfunction: function, stored +# NOTHING TO DO: new feature + +calendar / calendar.attendee / _order : _order is now 'create_date ASC' ('id') +# NOTHING TO DO + +calendar / calendar.event / description (text) : type is now 'html' ('text') +# DONE: pre-migration: convert text to html + +calendar / calendar.event / videocall_location (char) : NEW +# NOTHING TO DO: new feature + +calendar / calendar.event / weekday (selection) : selection_keys is now '['FRI', 'MON', 'SAT', 'SUN', 'THU', 'TUE', 'WED']' ('['FR', 'MO', 'SA', 'SU', 'TH', 'TU', 'WE']') +# NOTHING TO DO: non-stored field + +calendar / calendar.event.type / color (integer) : NEW hasdefault +# NOTHING TO DO: new feature + +calendar / calendar.filters / partner_checked (boolean) : NEW hasdefault +# DONE: pre-migration: create column with type bool and set the default value 'True' + +calendar / calendar.recurrence / fr (boolean) : DEL +calendar / calendar.recurrence / fri (boolean) : NEW +calendar / calendar.recurrence / mo (boolean) : DEL +calendar / calendar.recurrence / mon (boolean) : NEW +calendar / calendar.recurrence / sa (boolean) : DEL +calendar / calendar.recurrence / sat (boolean) : NEW +calendar / calendar.recurrence / su (boolean) : DEL +calendar / calendar.recurrence / sun (boolean) : NEW +calendar / calendar.recurrence / th (boolean) : DEL +calendar / calendar.recurrence / thu (boolean) : NEW +calendar / calendar.recurrence / tu (boolean) : DEL +calendar / calendar.recurrence / tue (boolean) : NEW +calendar / calendar.recurrence / we (boolean) : DEL +calendar / calendar.recurrence / wed (boolean) : NEW +# DONE: pre-migration: renamed columns + +calendar / calendar.recurrence / weekday (selection) : selection_keys is now '['FRI', 'MON', 'SAT', 'SUN', 'THU', 'TUE', 'WED']' ('['FR', 'MO', 'SA', 'SU', 'TH', 'TU', 'WE']') +# DONE: pre-migration: change the value of key + +calendar / mail.activity.type / category (False) : selection_keys is now '['default', 'meeting', 'phonecall', 'upload_file']' ('['default', 'meeting', 'upload_file']') +# NOTHING TO DO: not processed in this module + +calendar / res.partner / meeting_count (integer) : previously in module crm +calendar / res.partner / meeting_ids (many2many) : previously in module crm +calendar / res.users / meeting_count (integer) : previously in module crm +calendar / res.users / meeting_ids (many2many) : previously in module crm +# NOTHING TO DO: Handled by ORM when crm is installed + +---XML records in module 'calendar'--- +NEW ir.model.access: calendar.access_calendar_filters +NEW ir.model.access: calendar.access_calendar_filters_all +DEL ir.model.access: calendar.access_calendar_contacts +DEL ir.model.access: calendar.access_calendar_contacts_all +NEW ir.model.constraint: calendar.constraint_calendar_filters_user_id_partner_id_unique +NEW ir.ui.menu: calendar.calendar_menu_config +NEW ir.ui.menu: calendar.calendar_submenu_reminders +NEW ir.ui.view: calendar.res_partner_kanban_view +NEW ir.ui.view: calendar.res_users_view_form +NEW ir.ui.view: calendar.view_partners_form +DEL ir.ui.view: calendar.assets_backend +DEL ir.ui.view: calendar.qunit_suite +NEW mail.template: calendar.calendar_template_meeting_update (noupdate) +# NOTHING TO DO + +ir.model.constraint: calendar.constraint_calendar_recurrence_month_day (changed definition: is now 'check( +rrule_type != 'monthly' or month_by != 'day' or day >= 1 and day <= 31 or +weekday in('mon','tue','wed','thu','fri','sat','sun') and byday in('1','2','3','4','-1'))' ('check( +rrule_type != 'monthly' or month_by != 'day' or day >= 1 and day <= 31 or +weekday in('mo','tu','we','th','fr','sa','su') and byday in('1','2','3','4','-1'))')) +# DONE: pre-migration: deleted in order to let odoo add it again directly with the new definition + +DEL ir.model.constraint: calendar.constraint_calendar_contacts_user_id_partner_id_unique +# DONE: pre-migration: deleted safely diff --git a/openupgrade_scripts/scripts/mail/15.0.1.5/pre-migration.py b/openupgrade_scripts/scripts/mail/15.0.1.5/pre-migration.py index 3751905cab66..68f4e8fc963e 100644 --- a/openupgrade_scripts/scripts/mail/15.0.1.5/pre-migration.py +++ b/openupgrade_scripts/scripts/mail/15.0.1.5/pre-migration.py @@ -46,6 +46,13 @@ def _rename_fields(env): def _rename_tables(env): + openupgrade.delete_sql_constraint_safely( + env, + "mail", + "mail_message_res_partner_needaction_rel", + "notification_partner_required", + ) + # we delete sql constraint before table rename openupgrade.rename_tables( env.cr, [("mail_message_res_partner_needaction_rel", "mail_notification")] ) @@ -65,7 +72,6 @@ def delete_obsolete_constraints(env): _contraints = [ ("mail", "mail_followers", "mail_followers_res_channel_res_model_id_uniq"), ("mail", "mail_followers", "partner_xor_channel"), - ("mail", "mail_notification", "notification_partner_required"), ("mail", "mail_moderation", "channel_email_uniq"), ] for module, table, name in _contraints: