credativ team mailing list archive
-
credativ team
-
Mailing list archive
-
Message #05121
[Merge] lp:~therp-nl/openupgrade-server/7.0-lp1131653_workaround into lp:openupgrade-server
Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/openupgrade-server/7.0-lp1131653_workaround into lp:openupgrade-server.
Requested reviews:
OpenUpgrade Committers (openupgrade-committers)
For more details, see:
https://code.launchpad.net/~therp-nl/openupgrade-server/7.0-lp1131653_workaround/+merge/150071
--
https://code.launchpad.net/~therp-nl/openupgrade-server/7.0-lp1131653_workaround/+merge/150071
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~therp-nl/openupgrade-server/7.0-lp1131653_workaround into lp:openupgrade-server.
=== modified file 'openerp/openupgrade/openupgrade.py'
--- openerp/openupgrade/openupgrade.py 2012-11-24 22:33:20 +0000
+++ openerp/openupgrade/openupgrade.py 2013-02-22 15:33:26 +0000
@@ -2,7 +2,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
-# This module copyright (C) 2011-2012 Therp BV (<http://therp.nl>)
+# This module copyright (C) 2011-2013 Therp BV (<http://therp.nl>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -22,7 +22,7 @@
import os
import inspect
import logging
-from openerp import release, osv, pooler, tools
+from openerp import release, osv, pooler, tools, SUPERUSER_ID
import openupgrade_tools
# The server log level has not been set at this point
@@ -220,7 +220,9 @@
def write_value(ids, field, value):
logger.debug("model %s, field %s: setting default value of resources %s to %s",
model, field, ids, unicode(value))
- obj.write(cr, 1, ids, {field: value})
+ for res_id in ids:
+ # Iterating over ids here as a workaround for lp:1131653
+ obj.write(cr, SUPERUSER_ID, [res_id], {field: value})
for model in default_spec.keys():
obj = pool.get(model)
@@ -229,7 +231,7 @@
for field, value in default_spec[model]:
domain = not force and [(field, '=', False)] or []
- ids = obj.search(cr, 1, domain)
+ ids = obj.search(cr, SUPERUSER_ID, domain)
if not ids:
continue
if value is None:
@@ -324,8 +326,9 @@
:param original_name: the original name of the column
:param version: current version as passed to migrate()
"""
- return 'openupgrade_legacy_'+('_').join(map(str, release.version_info))+'_'+original_name
-
+ return 'openupgrade_legacy_'+('_').join(
+ map(str, release.version_info[0:2]))+'_'+original_name
+
def migrate():
"""
This is the decorator for the migrate() function
Follow ups