Ejemplo n.º 1
0
def migrate(cr, version):
    recompute_date_fields(cr)
    import_crm_meeting(cr)
    # now we filled new fields, recalculate some stored fields
    pool = RegistryManager.get(cr.dbname)
    calendar_event = pool['calendar.event']
    for field in ['start', 'stop', 'display_start']:
        calendar_event._update_store(cr, calendar_event._columns[field], field)
    migrate_attendees(cr)
    migrate_alarms(cr)
    # map renamed and deprecated reminder actions to 'notification'
    cr.execute('''update calendar_alarm
        set type='notification'
        where type in ('audio', 'display', 'procedure')''')
    # map renamed event states
    cr.execute('''update calendar_event
        set state='draft' where state in ('cancelled', 'tentative')''')
    cr.execute('''update calendar_event
        set state='open' where state in ('confirmed')''')
    # map renamed attendee states
    cr.execute('''update calendar_attendee
        set state='needsAction' where state in ('needs-action')''')
    # load modified noupdate data
    openupgrade.load_data(cr, 'calendar', 'migrations/8.0.1.0/data.xml')
    openupgrade_80.set_message_last_post(cr, SUPERUSER_ID, pool,
                                         ['calendar.event'])
Ejemplo n.º 2
0
def migrate(cr, version):
    pool = pooler.get_pool(cr.dbname)
    post_messages(cr, pool)
    openupgrade_80.set_message_last_post(cr, SUPERUSER_ID, pool,
                                         ['procurement.order'])
    process_states(cr)
    openupgrade.load_data(cr, 'procurement',
                          'migrations/8.0.1.0/noupdate_changes.xml')
def migrate(cr, version):
    registry = RegistryManager.get(cr.dbname)
    openupgrade.load_data(cr, 'sale',
                          'migrations/8.0.1.0/noupdate_changes.xml')
    openupgrade_80.set_message_last_post(cr, SUPERUSER_ID, registry,
                                         ['sale.order'])
    openupgrade.date_to_datetime_tz(cr, 'sale_order', 'user_id',
                                    openupgrade.get_legacy_name('date_order'),
                                    'date_order')
Ejemplo n.º 4
0
def load_data(cr):
    '''
    Update the references to base.group_portal
    :param cr:
    '''
    openupgrade.load_data(cr,
                          'portal_sale',
                          'migrations/8.0.0.1/modified_data.xml',
                          mode='init')
Ejemplo n.º 5
0
def migrate(cr, version):
    pool = pooler.get_pool(cr.dbname)

    map_notify_email(cr)
    mail_mail_to_mail_message_migration(cr, uid, pool)
    openupgrade_80.set_message_last_post(
        cr, uid, pool, ['res.partner', 'mail.group'])
    openupgrade_80.update_aliases(cr, pool, 'mail.group', True)
    openupgrade_80.update_aliases(cr, pool, 'res.users', True)
    openupgrade.load_data(
        cr, 'mail', 'migrations/8.0.1.0/noupdate_changes.xml')
def migrate(cr, version):
    pool = RegistryManager.get(cr.dbname)

    openupgrade.map_values(cr,
                           openupgrade.get_legacy_name('priority'),
                           'priority', [('5', '0'), ('4', '0'), ('3', '1'),
                                        ('2', '2'), ('1', '2')],
                           table='project_issue',
                           write='sql')

    openupgrade_80.set_message_last_post(cr, uid, pool, ['project.issue'])

    openupgrade.load_data(cr, 'project_issue',
                          'migrations/8.0.1.0/noupdate_changes.xml')
def migrate(cr, version):
    registry = RegistryManager.get(cr.dbname)

    openupgrade.map_values(
        cr, 'priority', openupgrade.get_legacy_name('priority'),
        [('5', '0'), ('4', '1'), ('3', '2'), ('2', '3'), ('1', '4')],
        table='crm_lead')
    openupgrade.map_values(
        cr, 'priority', openupgrade.get_legacy_name('priority'),
        [('5', '0'), ('4', '0'), ('3', '1'), ('1', '2')],
        table='crm_phonecall')
    openupgrade.logged_query(
        cr, "UPDATE crm_phonecall SET state = %s WHERE state = %s",
        ('draft', 'pending'))

    # Set the date of the last update
    subtype_ids = (
        registry['ir.model.data'].get_object_reference(
            cr, SUPERUSER_ID, 'crm', 'mt_lead_stage')[1],
        registry['ir.model.data'].get_object_reference(
            cr, SUPERUSER_ID, 'crm', 'mt_salesteam_lead_stage')[1])

    # Update event tracking datetime fields
    openupgrade_80.set_message_last_post(
        cr, SUPERUSER_ID, registry, ['crm.phonecall', 'crm.lead'])
    openupgrade.logged_query(
        cr,
        """
        UPDATE crm_lead l
        SET date_last_stage_update = COALESCE(
            (SELECT MAX(create_date) FROM mail_message m
             WHERE subtype_id in %s
                AND m.res_id = l.id),
            l.create_date)
        """, (subtype_ids,))

    # Move opportunity and phonecall to matching calendar_event
    openupgrade.logged_query(
        cr,
        """
        UPDATE calendar_event e
        SET opportunity_id = m.opportunity_id,
            phonecall_id = m.phonecall_id
        FROM crm_meeting m
        WHERE e.{} = m.id""".format(
            openupgrade.get_legacy_name('crm_meeting_id')))

    openupgrade.load_data(cr, 'crm', 'migrations/8.0.1.0/noupdate_changes.xml')
Ejemplo n.º 8
0
def migrate(cr, version):
    registry = RegistryManager.get(cr.dbname)

    openupgrade.map_values(cr,
                           openupgrade.get_legacy_name('priority'),
                           'priority', [('4', '0'), ('3', '0'), ('2', '1'),
                                        ('1', '2'), ('0', '2')],
                           table='project_task',
                           write='sql')

    openupgrade_80.update_aliases(cr,
                                  registry,
                                  'project.project',
                                  set_parent_thread_id=True,
                                  defaults_id_key='project_id')

    openupgrade_80.set_message_last_post(cr, uid, registry,
                                         ['project.project', 'project.task'])

    openupgrade.load_data(cr, 'project',
                          'migrations/8.0.1.1/noupdate_changes.xml')
Ejemplo n.º 9
0
def load_data(cr):
    openupgrade.load_data(cr,
                          'product',
                          'migrations/8.0.1.1/modified_data.xml',
                          mode='init')
def migrate(cr, version):
    openupgrade.load_data(cr, 'portal', 'portal_data.xml')