credativ team mailing list archive
-
credativ team
-
Mailing list archive
-
Message #04736
[Merge] lp:~openupgrade-committers/openupgrade-addons/base-contact into lp:openupgrade-addons
Dmitrijs Ledkovs (credativ) has proposed merging lp:~openupgrade-committers/openupgrade-addons/base-contact into lp:openupgrade-addons.
Requested reviews:
OpenUpgrade Committers (openupgrade-committers)
For more details, see:
https://code.launchpad.net/~openupgrade-committers/openupgrade-addons/base-contact/+merge/97170
base_contact migrated.
x_openupgrade_job_id follows the convention of ignored x_* fields. (similar to magento properties stored on products for example)
This will be used in migration of other modules that happen to extend res.partner.jobs, e.g. base_contact_team or private modules that extend that. ;-)
--
https://code.launchpad.net/~openupgrade-committers/openupgrade-addons/base-contact/+merge/97170
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~openupgrade-committers/openupgrade-addons/base-contact into lp:openupgrade-addons.
=== added file 'base_contact/migrations/6.1.1.0/post-migration.py'
--- base_contact/migrations/6.1.1.0/post-migration.py 1970-01-01 00:00:00 +0000
+++ base_contact/migrations/6.1.1.0/post-migration.py 2012-03-13 09:51:25 +0000
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+
+from osv import osv
+import logging
+from openerp.openupgrade import openupgrade
+
+logger = logging.getLogger('OpenUpgrade')
+me = __file__
+
+
+def _migrate_jobs(cr):
+ if not openupgrade.table_exists(cr, 'res_partner_job'):
+ return
+ openupgrade.logged_query(cr,"""
+ ALTER TABLE res_partner_address ADD COLUMN x_openupgrade_job_id integer
+ """)
+ openupgrade.logged_query(cr,"""
+ INSERT INTO
+ res_partner_address
+ (create_uid,create_date,write_date,write_uid,location_id,contact_id,
+ function,phone,fax,email,active,partner_id,company_id,
+ x_openupgrade_job_id)
+ SELECT
+ job.create_uid,job.create_date,job.write_date,job.write_uid,job.address_id,job.contact_id,
+ job.function,job.phone,job.fax,job.email,true,adr.partner_id,adr.company_id,
+ job.id
+ FROM
+ res_partner_job job
+ join
+ res_partner_address adr on address_id=adr.id
+ """)
+
+def migrate(cr, version):
+ if not version:
+ return
+ try:
+ logger.info("%s called", me)
+ _migrate_jobs(cr)
+ except Exception, e:
+ raise osv.except_osv("OpenUpgrade", '%s: %s' % (me, e))
+
=== added file 'base_contact/migrations/6.1.1.0/pre-migration.py'
--- base_contact/migrations/6.1.1.0/pre-migration.py 1970-01-01 00:00:00 +0000
+++ base_contact/migrations/6.1.1.0/pre-migration.py 2012-03-13 09:51:25 +0000
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+
+from osv import osv
+import logging
+from openerp.openupgrade import openupgrade
+
+logger = logging.getLogger('OpenUpgrade')
+me = __file__
+
+
+def _migrate_last_name(cr):
+ column_renames = {
+ 'res_partner_contact': [
+ ('name', 'last_name'),
+ ],
+ }
+ #if openupgrade.table_exists(cr, 'res_partner_contact'):
+ # return
+ #if not openupgrade.column_exists(cr, 'res_partner_contact', 'last_name'):
+ # return
+ openupgrade.rename_columns(cr, column_renames)
+
+def _migrate_birthdate(cr):
+ openupgrade.logged_query(cr, 'alter table res_partner_contact alter column birthdate type character varying(64);')
+
+def migrate(cr, version):
+ if not version:
+ return
+ try:
+ logger.info("%s called", me)
+ _migrate_last_name(cr)
+ _migrate_birthdate(cr)
+ except Exception, e:
+ raise osv.except_osv("OpenUpgrade", '%s: %s' % (me, e))
=== added file 'base_contact/migrations/6.1.1.0/user_notes.txt'
--- base_contact/migrations/6.1.1.0/user_notes.txt 1970-01-01 00:00:00 +0000
+++ base_contact/migrations/6.1.1.0/user_notes.txt 2012-03-13 09:51:25 +0000
@@ -0,0 +1,21 @@
+Overview:
+- res.partner.address is changed to res.partner.location + contact
+- res.partner.jobs is dropped in favor of using res.partner.address
+- res.partner.contact itself stayed about the same (explicit last_name added)
+
+The following fields from res.partner.jobs no longer have equivalent:
+- 'sequence_contact': fields.integer('Contact Seq.',help='Order of importance of this address in the list of addresses of the linked contact'),
+- 'sequence_partner': fields.integer('Partner Seq.',help='Order of importance of this job title in the list of job title of the linked partner'),
+- 'extension': fields.char('Extension', size=64, help='Internal/External extension phone number'),
+- 'other': fields.char('Other', size=64, help='Additional phone field'),
+- 'date_start': fields.date('Date Start',help="Start date of job(Joining Date)"),
+- 'date_stop': fields.date('Date Stop', help="Last date of job"),
+- 'state': fields.selection([('past', 'Past'),('current', 'Current')], 'State', required=True, help="Status of Address"),
+
+You may want to review your data if you use above fields.
+
+res.partner.job table is not dropped.
+
+Original res.partner.job.id is stored in column x_openupgrade_job_id of
+res.partner.address object, which can be reused later on to migrate above fields
+into notes field or res.partner.address for example.
Follow ups