asset: cachezeit verkürzt
This commit is contained in:
parent
8503fd3e32
commit
0daf39b913
3 changed files with 3 additions and 44 deletions
30
rate.py
30
rate.py
|
@ -87,34 +87,4 @@ class Rate(SymbolMixin, ModelSQL, ModelView):
|
|||
result[n][record[0]] = r1[n]
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def create(cls, vlist):
|
||||
""" clear cache
|
||||
"""
|
||||
Asset = Pool().get('investment.asset')
|
||||
|
||||
Asset.values_cache_clear(
|
||||
[x['asset'] for x in vlist],
|
||||
['change_day1', 'change_month1', 'change_month3',
|
||||
'change_month6', 'change_month12'],
|
||||
)
|
||||
return super(Rate, cls).create(vlist)
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
""" clear cache
|
||||
"""
|
||||
Asset = Pool().get('investment.asset')
|
||||
|
||||
asset_ids = []
|
||||
actions = iter(args)
|
||||
for rates, values in zip(actions, actions):
|
||||
asset_ids.extend([x.asset.id for x in rates])
|
||||
|
||||
if len(asset_ids) > 0:
|
||||
Asset.values_cache_clear(asset_ids,
|
||||
['change_day1', 'change_month1', 'change_month3',
|
||||
'change_month6', 'change_month12'])
|
||||
super(Rate, cls).write(*args)
|
||||
|
||||
# Rate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue