formatting

This commit is contained in:
Frederik Jaeckel 2023-12-01 13:29:46 +01:00
parent 1a55e9fa7e
commit 34fa28eeb9
4 changed files with 17 additions and 6 deletions

View file

@ -15,6 +15,7 @@ from sql.functions import CurrentDate, CurrentTimestamp, Round, Extract
from sql.conditionals import Case, Coalesce, NullIf from sql.conditionals import Case, Coalesce, NullIf
from sql import Literal from sql import Literal
from .diagram import Concat2 from .diagram import Concat2
from .const import DEF_NONE
digits_percent = 2 digits_percent = 2
@ -100,8 +101,8 @@ class Asset(SymbolMixin, ModelSQL, ModelView):
string='URL', string='URL',
help='URL for data retrieval.', help='URL for data retrieval.',
states={ states={
'invisible': Eval('updturl_enable', False) == False, 'invisible': ~Eval('updturl_enable', False),
'required': Eval('updturl_enable', False) == True, 'required': Eval('updturl_enable', False),
}, depends=['updturl_enable']) }, depends=['updturl_enable'])
updturl_enable = fields.Function(fields.Boolean( updturl_enable = fields.Function(fields.Boolean(
string='URL required', readonly=True, string='URL required', readonly=True,
@ -176,7 +177,7 @@ class Asset(SymbolMixin, ModelSQL, ModelView):
query = tab_asset.select( query = tab_asset.select(
tab_asset.id, tab_asset.id,
tab_asset.updtsource, tab_asset.updtsource,
where=tab_asset.updtsource != None, where=tab_asset.updtsource != DEF_NONE,
) )
cursor.execute(*query) cursor.execute(*query)
records = cursor.fetchall() records = cursor.fetchall()
@ -823,7 +824,7 @@ class Asset(SymbolMixin, ModelSQL, ModelView):
).select( ).select(
tab_asset.id, tab_asset.id,
where=Operator(field_qu, clause[2]) & where=Operator(field_qu, clause[2]) &
(field_qu != None), (field_qu != DEF_NONE),
) )
return [('id', 'in', query)] return [('id', 'in', query)]

8
const.py Normal file
View file

@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
# This file is part of the cashbook-module from m-ds.de for Tryton.
# The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms.
DEF_TRUE = True
DEF_NONE = None

View file

@ -173,7 +173,8 @@ class ImportWizard(Wizard):
datefmt='dd%sdd' % dec_divider, datefmt='dd%sdd' % dec_divider,
colnr='2')) colnr='2'))
if isinstance(date_val, date) and isinstance(rate_val, Decimal): if isinstance(date_val, date) and isinstance(
rate_val, Decimal):
result.append({'date': date_val, 'rate': rate_val}) result.append({'date': date_val, 'rate': rate_val})
# date range # date range

View file

@ -86,7 +86,8 @@ class OnlineSource(ModelSQL, ModelView):
states=STATES_WEB, depends=DEPENDS_WEB) states=STATES_WEB, depends=DEPENDS_WEB)
rgxdecimal = fields.Selection( rgxdecimal = fields.Selection(
string='Decimal Separator', string='Decimal Separator',
help='Decimal separator for converting the market value into a number.', help='Decimal separator for converting the market ' +
'value into a number.',
selection=sel_rgxdecimal, states=STATES_WEB, depends=DEPENDS_WEB) selection=sel_rgxdecimal, states=STATES_WEB, depends=DEPENDS_WEB)
rgxident = fields.Char( rgxident = fields.Char(
string='Identifier', string='Identifier',