[MERGE] Forward-port 7.0 up to bdbcbea285
This commit is contained in:
commit
e8d06f7b20
|
@ -179,7 +179,7 @@ Normal - the campaign runs normally and automatically sends all emails and repor
|
|||
def _get_partner_for(self, campaign, record):
|
||||
partner_field = campaign.partner_field_id.name
|
||||
if partner_field:
|
||||
return getattr(record, partner_field)
|
||||
return record[partner_field]
|
||||
elif campaign.object_id.model == 'res.partner':
|
||||
return record
|
||||
return None
|
||||
|
|
|
@ -1093,30 +1093,8 @@ class ir_model_data(osv.osv):
|
|||
return res_id
|
||||
|
||||
def ir_set(self, cr, uid, key, key2, name, models, value, replace=True, isobject=False, meta=None, xml_id=False):
|
||||
if isinstance(models[0], (list, tuple)):
|
||||
model,res_id = models[0]
|
||||
else:
|
||||
res_id=None
|
||||
model = models[0]
|
||||
|
||||
if res_id:
|
||||
where = ' and res_id=%s' % (res_id,)
|
||||
else:
|
||||
where = ' and (res_id is null)'
|
||||
|
||||
if key2:
|
||||
where += ' and key2=\'%s\'' % (key2,)
|
||||
else:
|
||||
where += ' and (key2 is null)'
|
||||
|
||||
cr.execute('select * from ir_values where model=%s and key=%s and name=%s'+where,(model, key, name))
|
||||
res = cr.fetchone()
|
||||
ir_values_obj = openerp.registry(cr.dbname)['ir.values']
|
||||
if not res:
|
||||
ir_values_obj.set(cr, uid, key, key2, name, models, value, replace, isobject, meta)
|
||||
elif xml_id:
|
||||
cr.execute('UPDATE ir_values set value=%s WHERE model=%s and key=%s and name=%s'+where,(value, model, key, name))
|
||||
ir_values_obj.invalidate_cache(cr, uid, ['value'])
|
||||
ir_values_obj.set(cr, uid, key, key2, name, models, value, replace, isobject, meta)
|
||||
return True
|
||||
|
||||
def _module_data_uninstall(self, cr, uid, modules_to_remove, context=None):
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import pickle
|
||||
|
||||
from openerp import tools
|
||||
from openerp.osv import osv, fields
|
||||
from openerp.osv.orm import except_orm
|
||||
from openerp.tools import pickle
|
||||
|
||||
EXCLUDED_FIELDS = set((
|
||||
'report_sxw_content', 'report_rml_content', 'report_sxw', 'report_rml',
|
||||
|
|
|
@ -44,7 +44,6 @@ import functools
|
|||
import itertools
|
||||
import logging
|
||||
import operator
|
||||
import pickle
|
||||
import pytz
|
||||
import re
|
||||
import time
|
||||
|
@ -68,7 +67,7 @@ from .osv.query import Query
|
|||
from .tools import frozendict, lazy_property, ormcache
|
||||
from .tools.config import config
|
||||
from .tools.func import frame_codeinfo
|
||||
from .tools.misc import CountingStream, DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT
|
||||
from .tools.misc import CountingStream, DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT, pickle
|
||||
from .tools.safe_eval import safe_eval as eval
|
||||
from .tools.translate import _
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import cStringIO
|
|||
import csv
|
||||
import logging
|
||||
import os.path
|
||||
import pickle
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
@ -58,7 +57,7 @@ from translate import _
|
|||
# List of etree._Element subclasses that we choose to ignore when parsing XML.
|
||||
from misc import SKIPPED_ELEMENT_TYPES
|
||||
|
||||
from misc import unquote
|
||||
from misc import pickle, unquote
|
||||
|
||||
from openerp import SUPERUSER_ID
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ Miscellaneous tools used by OpenERP.
|
|||
"""
|
||||
|
||||
from functools import wraps
|
||||
import cPickle
|
||||
import cProfile
|
||||
from contextlib import contextmanager
|
||||
import subprocess
|
||||
|
@ -37,6 +38,7 @@ import threading
|
|||
import time
|
||||
import werkzeug.utils
|
||||
import zipfile
|
||||
from cStringIO import StringIO
|
||||
from collections import defaultdict, Mapping, OrderedDict
|
||||
from datetime import datetime
|
||||
from itertools import islice, izip, groupby
|
||||
|
@ -1194,7 +1196,6 @@ def stripped_sys_argv(*strip_args):
|
|||
|
||||
return [x for i, x in enumerate(args) if not strip(args, i)]
|
||||
|
||||
|
||||
class ConstantMapping(Mapping):
|
||||
"""
|
||||
An immutable mapping returning the provided value for every single key.
|
||||
|
@ -1302,4 +1303,21 @@ else:
|
|||
def html_escape(text):
|
||||
return werkzeug.utils.escape(text)
|
||||
|
||||
class Pickle(object):
|
||||
@classmethod
|
||||
def load(cls, stream):
|
||||
unpickler = cPickle.Unpickler(stream)
|
||||
# pickle builtins: str/unicode, int/long, float, bool, tuple, list, dict, None
|
||||
unpickler.find_global = None
|
||||
return unpickler.load()
|
||||
|
||||
@classmethod
|
||||
def loads(cls, text):
|
||||
return cls.load(StringIO(text))
|
||||
|
||||
dumps = cPickle.dumps
|
||||
dump = cPickle.dump
|
||||
|
||||
pickle = Pickle
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
Loading…
Reference in New Issue