[FIX] ir.translation: clear cache of function _get_ids when writing a translation
[FIX] ir.translation: cache of function _get_ids must be multi on ids [FIX] cache system: bug with multi lp bug: https://launchpad.net/bugs/314334 fixed bzr revid: christophe@tinyerp.com-20090106162838-fukq9grp6dk97v61
This commit is contained in:
parent
97ed5c5fce
commit
7381181cb9
|
@ -79,9 +79,9 @@ class ir_translation(osv.osv):
|
|||
cr.execute('CREATE INDEX ir_translation_lts ON ir_translation (lang, type, src)')
|
||||
cr.commit()
|
||||
|
||||
@tools.cache(skiparg=3)
|
||||
@tools.cache(skiparg=3, multi='ids')
|
||||
def _get_ids(self, cr, uid, name, tt, lang, ids):
|
||||
translations = {}
|
||||
translations = dict.fromkeys(ids, False)
|
||||
if ids:
|
||||
cr.execute('select res_id,value ' \
|
||||
'from ir_translation ' \
|
||||
|
@ -92,9 +92,6 @@ class ir_translation(osv.osv):
|
|||
(lang,tt,name))
|
||||
for res_id, value in cr.fetchall():
|
||||
translations[res_id] = value
|
||||
for res_id in ids:
|
||||
if res_id not in translations:
|
||||
translations[res_id] = False
|
||||
return translations
|
||||
|
||||
def _set_ids(self, cr, uid, name, tt, lang, ids, value):
|
||||
|
@ -104,6 +101,7 @@ class ir_translation(osv.osv):
|
|||
if tr[res_id]:
|
||||
self._get_source.clear_cache(cr.dbname, uid, name, tt, lang, tr[res_id])
|
||||
self._get_source.clear_cache(cr.dbname, uid, name, tt, lang)
|
||||
self._get_ids.clear_cache(cr.dbname, uid, name, tt, lang, ids)
|
||||
|
||||
cr.execute('delete from ir_translation ' \
|
||||
'where lang=%s ' \
|
||||
|
|
|
@ -569,7 +569,7 @@ class cache(object):
|
|||
else:
|
||||
multis = kwargs2[self.multi][:]
|
||||
for id in multis:
|
||||
kwargs2[self.multi] = [id]
|
||||
kwargs2[self.multi] = (id,)
|
||||
key = (('dbname', dbname),) + to_tuple(kwargs2)
|
||||
yield key, id
|
||||
|
||||
|
@ -614,7 +614,6 @@ class cache(object):
|
|||
self.fun_default_values = {}
|
||||
if argspec[3]:
|
||||
self.fun_default_values = dict(zip(self.fun_arg_names[-len(argspec[3]):], argspec[3]))
|
||||
debug(self.fun_default_values)
|
||||
|
||||
def cached_result(self2, cr, *args, **kwargs):
|
||||
if time.time()-self.timeout > self.lasttime:
|
||||
|
|
Loading…
Reference in New Issue