asset: rekursion behoben, erlaubt aktion nach update
This commit is contained in:
parent
ac0bced963
commit
94169fb416
2 changed files with 11 additions and 2 deletions
4
asset.py
4
asset.py
|
@ -318,6 +318,8 @@ class Asset(SymbolMixin, ModelSQL, ModelView):
|
|||
def get_rate_data(cls, assets, names):
|
||||
""" get date and rate of asset
|
||||
"""
|
||||
Asset2 = Pool().get('investment.asset')
|
||||
|
||||
cursor = Transaction().connection.cursor()
|
||||
(query, tab_asset) = cls.get_rate_data_sql()
|
||||
query.where=tab_asset.id.in_([x.id for x in assets])
|
||||
|
@ -330,7 +332,7 @@ class Asset(SymbolMixin, ModelSQL, ModelView):
|
|||
for record in records:
|
||||
(id1, rate1, date1) = record
|
||||
|
||||
asset = Asset(id1)
|
||||
asset = Asset2(id1)
|
||||
exp = Decimal(Decimal(1) / 10 ** (asset.currency_digits or 4))
|
||||
|
||||
values = {'rate': record[1].quantize(exp), 'date': record[2]}
|
||||
|
|
|
@ -24,8 +24,15 @@ class UpdateSoureWizard(Wizard):
|
|||
context = Transaction().context
|
||||
|
||||
assets = Asset.browse(context.get('active_ids', []))
|
||||
to_run_activities = []
|
||||
for asset in assets:
|
||||
OnlineSource.update_rate(asset)
|
||||
if OnlineSource.update_rate(asset):
|
||||
to_run_activities.append(asset)
|
||||
|
||||
if len(to_run_activities) > 0:
|
||||
Asset.after_update_actions(to_run_activities)
|
||||
|
||||
return 'end'
|
||||
|
||||
# UpdateSoureWizard
|
||||
|
||||
|
|
Loading…
Reference in a new issue