asset/onlinesource: add fixed url,
pre defned online sources: add FAZ.net
This commit is contained in:
parent
edfa0424e5
commit
82f9d3a792
8 changed files with 120 additions and 13 deletions
26
asset.py
26
asset.py
|
@ -8,6 +8,7 @@ from trytond.transaction import Transaction
|
|||
from trytond.pool import Pool
|
||||
from trytond.pyson import Eval, Bool, If, Date
|
||||
from trytond.report import Report
|
||||
from trytond.exceptions import UserError
|
||||
|
||||
from decimal import Decimal
|
||||
from datetime import time
|
||||
|
@ -84,8 +85,19 @@ class Asset(SymbolMixin, ModelSQL, ModelView):
|
|||
help='Select sources for the course update. The course sources are tried until a valid value has been read.',
|
||||
relation_name='investment.asset_source_rel',
|
||||
origin='asset', target='source')
|
||||
updtdays = fields.Selection(string='Select days', required=True,
|
||||
selection=sel_updtdays)
|
||||
updturl = fields.Char(
|
||||
string='URL',
|
||||
help='URL for data retrieval.',
|
||||
states={
|
||||
'invisible': Eval('updturl_enable', False) == False,
|
||||
'required': Eval('updturl_enable', False) == True,
|
||||
}, depends=['updturl_enable'])
|
||||
updturl_enable = fields.Function(fields.Boolean(
|
||||
string='URL required', readonly=True,
|
||||
states={'invisible': True}),
|
||||
'on_change_with_updturl_enable')
|
||||
updtdays = fields.Selection(
|
||||
string='Select days', required=True, selection=sel_updtdays)
|
||||
updttime = fields.Time(string='Time',
|
||||
states={
|
||||
'readonly': ~Bool(Eval('updtsources')),
|
||||
|
@ -206,6 +218,16 @@ class Asset(SymbolMixin, ModelSQL, ModelView):
|
|||
"""
|
||||
return 'work'
|
||||
|
||||
@fields.depends('updtsources')
|
||||
def on_change_with_updturl_enable(self, name=None):
|
||||
""" return True if a source has fixed-url
|
||||
"""
|
||||
if self.updtsources:
|
||||
for usource in self.updtsources:
|
||||
if usource.fixed_url == True:
|
||||
return True
|
||||
return False
|
||||
|
||||
@fields.depends('updtsources', 'updttime')
|
||||
def on_change_updtsources(self):
|
||||
""" clear time-fields
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue