[MERGE] Forward-port saas-6 up to 6562309927
This commit is contained in:
@@ -160,7 +160,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
|
||||
|
||||
@@ -1148,30 +1148,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):
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
import pickle
|
||||
|
||||
from openerp import tools
|
||||
from openerp.osv import osv, fields
|
||||
from openerp.exceptions import AccessError, MissingError
|
||||
from openerp.tools.translate import _
|
||||
from openerp.tools import pickle
|
||||
|
||||
EXCLUDED_FIELDS = set((
|
||||
'report_sxw_content', 'report_rml_content', 'report_sxw', 'report_rml',
|
||||
|
||||
+1
-2
@@ -27,7 +27,6 @@ import functools
|
||||
import itertools
|
||||
import logging
|
||||
import operator
|
||||
import pickle
|
||||
import pytz
|
||||
import re
|
||||
import time
|
||||
@@ -51,7 +50,7 @@ from .osv.query import Query
|
||||
from .tools import frozendict, lazy_property, ormcache, Collector
|
||||
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 _
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import cStringIO
|
||||
import csv
|
||||
import logging
|
||||
import os.path
|
||||
import pickle
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
@@ -26,7 +25,7 @@ import misc
|
||||
from config import config
|
||||
# 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
|
||||
from translate import _
|
||||
from yaml_import import convert_yaml_import
|
||||
|
||||
+20
-2
@@ -7,6 +7,7 @@ Miscellaneous tools used by OpenERP.
|
||||
"""
|
||||
|
||||
from functools import wraps
|
||||
import cPickle
|
||||
import cProfile
|
||||
from contextlib import contextmanager
|
||||
import subprocess
|
||||
@@ -19,6 +20,7 @@ import threading
|
||||
import time
|
||||
import werkzeug.utils
|
||||
import zipfile
|
||||
from cStringIO import StringIO
|
||||
from collections import defaultdict, Hashable, Iterable, Mapping, OrderedDict
|
||||
from itertools import islice, izip, groupby
|
||||
from lxml import etree
|
||||
@@ -987,7 +989,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.
|
||||
@@ -1168,4 +1169,21 @@ def _consteq(str1, str2):
|
||||
known length only, because length difference is optimized. """
|
||||
return len(str1) == len(str2) and sum(ord(x)^ord(y) for x, y in zip(str1, str2)) == 0
|
||||
|
||||
consteq = getattr(passlib.utils, 'consteq', _consteq)
|
||||
consteq = getattr(passlib.utils, 'consteq', _consteq)
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user