commit
11289a67f2
|
@ -91,8 +91,9 @@ class ir_attachment(osv.osv):
|
||||||
result = {}
|
result = {}
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
context['bin_size'] = False
|
ctx = context.copy()
|
||||||
for i in self.browse(cr, uid, ids, context=context):
|
ctx['bin_size'] = False
|
||||||
|
for i in self.browse(cr, uid, ids, context=ctx):
|
||||||
result[i.id] = False
|
result[i.id] = False
|
||||||
for format in ('png','jpg','jpeg','gif','bmp'):
|
for format in ('png','jpg','jpeg','gif','bmp'):
|
||||||
if (i.datas_fname and i.datas_fname.lower() or '').endswith(format):
|
if (i.datas_fname and i.datas_fname.lower() or '').endswith(format):
|
||||||
|
|
|
@ -107,6 +107,11 @@ class ir_rule(osv.osv):
|
||||||
for rule in self.browse(cr, uid, ids, context):
|
for rule in self.browse(cr, uid, ids, context):
|
||||||
eval_user_data = {'user': self.pool.get('res.users').browse(cr, 1, uid),
|
eval_user_data = {'user': self.pool.get('res.users').browse(cr, 1, uid),
|
||||||
'time':time}
|
'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:
|
if rule.domain_force:
|
||||||
res[rule.id] = eval(rule.domain_force, eval_user_data)
|
res[rule.id] = eval(rule.domain_force, eval_user_data)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -166,9 +166,9 @@ class res_partner(osv.osv):
|
||||||
'customer': lambda *a: 1,
|
'customer': lambda *a: 1,
|
||||||
'category_id': _default_category,
|
'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']
|
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)
|
return super(res_partner, self).copy(cr, uid, id, default, context)
|
||||||
|
|
||||||
def _check_ean_key(self, cr, uid, ids):
|
def _check_ean_key(self, cr, uid, ids):
|
||||||
|
|
|
@ -662,9 +662,9 @@ class cache(object):
|
||||||
self.fun_default_values = dict(zip(self.fun_arg_names[-len(argspec[3]):], argspec[3]))
|
self.fun_default_values = dict(zip(self.fun_arg_names[-len(argspec[3]):], argspec[3]))
|
||||||
|
|
||||||
def cached_result(self2, cr, *args, **kwargs):
|
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()
|
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]
|
old_keys = [key for key in self.cache if self.cache[key][1] < t]
|
||||||
for key in old_keys:
|
for key in old_keys:
|
||||||
del self.cache[key]
|
del self.cache[key]
|
||||||
|
|
Loading…
Reference in New Issue