Merge remote branch 'origin/master' into optimize

bzr revid: p_christ@hol.gr-20091102182257-7vwfz9okfz815pes
This commit is contained in:
P. Christeas 2009-11-02 20:22:57 +02:00
commit c411d2cfe6
4 changed files with 12 additions and 6 deletions

View File

@ -91,8 +91,9 @@ class ir_attachment(osv.osv):
result = {}
if context is None:
context = {}
context['bin_size'] = False
for i in self.browse(cr, uid, ids, context=context):
ctx = context.copy()
ctx['bin_size'] = False
for i in self.browse(cr, uid, ids, context=ctx):
result[i.id] = False
for format in ('png','jpg','jpeg','gif','bmp'):
if (i.datas_fname and i.datas_fname.lower() or '').endswith(format):

View File

@ -107,6 +107,11 @@ class ir_rule(osv.osv):
for rule in self.browse(cr, uid, ids, context):
eval_user_data = {'user': self.pool.get('res.users').browse(cr, 1, uid),
'time':time}
if rule.operand.startswith('user.') and rule.operand.count('.') > 1:
#Need to check user.field.field1.field2(if field is False,it will break the chain)
op = rule.operand[5:]
rule.operand = rule.operand[:5+len(op[:op.find('.')])] +' and '+ rule.operand + ' or False'
if rule.domain_force:
res[rule.id] = eval(rule.domain_force, eval_user_data)
else:

View File

@ -166,9 +166,9 @@ class res_partner(osv.osv):
'customer': lambda *a: 1,
'category_id': _default_category,
}
def copy(self, cr, uid, id, default=None, context={}):
def copy(self, cr, uid, id, default={}, context={}):
name = self.read(cr, uid, [id], ['name'])[0]['name']
default.update({'name': name+' (copy)', 'events':[]})
default.update({'name': name+ _(' (copy)'), 'events':[]})
return super(res_partner, self).copy(cr, uid, id, default, context)
def _check_ean_key(self, cr, uid, ids):

View File

@ -675,9 +675,9 @@ class cache(object):
self.fun_default_values = dict(zip(self.fun_arg_names[-len(argspec[3]):], argspec[3]))
def cached_result(self2, cr, *args, **kwargs):
if time.time()-self.timeout > self.lasttime:
if time.time()-int(self.timeout) > self.lasttime:
self.lasttime = time.time()
t = time.time()-self.timeout
t = time.time()-int(self.timeout)
old_keys = [key for key in self.cache if self.cache[key][1] < t]
for key in old_keys:
del self.cache[key]