credativ team mailing list archive
-
credativ team
-
Mailing list archive
-
Message #05092
[Merge] lp:~therp-nl/openupgrade-addons/6.1_fix_base_contact_name into lp:openupgrade-addons/6.1
Holger Brunn (Therp) has proposed merging lp:~therp-nl/openupgrade-addons/6.1_fix_base_contact_name into lp:openupgrade-addons/6.1.
Requested reviews:
OpenUpgrade Committers (openupgrade-committers)
Related bugs:
Bug #1091686 in OpenERP Addons: "base_contact: name field never populated"
https://bugs.launchpad.net/openobject-addons/+bug/1091686
For more details, see:
https://code.launchpad.net/~therp-nl/openupgrade-addons/6.1_fix_base_contact_name/+merge/140473
--
https://code.launchpad.net/~therp-nl/openupgrade-addons/6.1_fix_base_contact_name/+merge/140473
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~therp-nl/openupgrade-addons/6.1_fix_base_contact_name into lp:openupgrade-addons/6.1.
=== modified file 'base_contact/base_contact.py'
--- base_contact/base_contact.py 2012-02-15 13:22:13 +0000
+++ base_contact/base_contact.py 2012-12-18 15:24:31 +0000
@@ -93,7 +93,7 @@
return bool(value == 1)
exists = table_exists(self._table)
- super(res_partner_contact, self)._auto_init(cr, context)
+ result=super(res_partner_contact, self)._auto_init(cr, context)
if not exists:
cr.execute("""
@@ -108,6 +108,8 @@
cr.execute("update res_partner_address set contact_id=id")
cr.execute("select setval('res_partner_contact_id_seq', (select max(id)+1 from res_partner_contact))")
+ return result
+
res_partner_contact()
class res_partner_location(osv.osv):
=== modified file 'base_contact/migrations/6.1.1.0/pre-migration.py'
--- base_contact/migrations/6.1.1.0/pre-migration.py 2012-06-19 09:34:23 +0000
+++ base_contact/migrations/6.1.1.0/pre-migration.py 2012-12-18 15:24:31 +0000
@@ -23,31 +23,18 @@
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);')
+@openupgrade.migrate()
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))
+ _migrate_last_name(cr)
+ _migrate_birthdate(cr)
Follow ups