From faefea3b5f265f9c2e78df83c3659f7dd79c054c Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Fri, 1 Dec 2023 13:29:46 +0100 Subject: [PATCH] formatting --- asset.py | 9 +++++---- const.py | 8 ++++++++ import_wiz.py | 3 ++- onlinesource.py | 3 ++- 4 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 const.py diff --git a/asset.py b/asset.py index 98286af..dd62caa 100644 --- a/asset.py +++ b/asset.py @@ -15,6 +15,7 @@ from sql.functions import CurrentDate, CurrentTimestamp, Round, Extract from sql.conditionals import Case, Coalesce, NullIf from sql import Literal from .diagram import Concat2 +from .const import DEF_NONE digits_percent = 2 @@ -100,8 +101,8 @@ class Asset(SymbolMixin, ModelSQL, ModelView): string='URL', help='URL for data retrieval.', states={ - 'invisible': Eval('updturl_enable', False) == False, - 'required': Eval('updturl_enable', False) == True, + 'invisible': ~Eval('updturl_enable', False), + 'required': Eval('updturl_enable', False), }, depends=['updturl_enable']) updturl_enable = fields.Function(fields.Boolean( string='URL required', readonly=True, @@ -191,7 +192,7 @@ class Asset(SymbolMixin, ModelSQL, ModelView): query = tab_asset.select( tab_asset.id, tab_asset.updtsource, - where=tab_asset.updtsource != None, + where=tab_asset.updtsource != DEF_NONE, ) cursor.execute(*query) records = cursor.fetchall() @@ -838,7 +839,7 @@ class Asset(SymbolMixin, ModelSQL, ModelView): ).select( tab_asset.id, where=Operator(field_qu, clause[2]) & - (field_qu != None), + (field_qu != DEF_NONE), ) return [('id', 'in', query)] diff --git a/const.py b/const.py new file mode 100644 index 0000000..a01e781 --- /dev/null +++ b/const.py @@ -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 diff --git a/import_wiz.py b/import_wiz.py index 72e7d4e..4722557 100644 --- a/import_wiz.py +++ b/import_wiz.py @@ -173,7 +173,8 @@ class ImportWizard(Wizard): datefmt='dd%sdd' % dec_divider, 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}) # date range diff --git a/onlinesource.py b/onlinesource.py index c881aa5..a74696a 100644 --- a/onlinesource.py +++ b/onlinesource.py @@ -86,7 +86,8 @@ class OnlineSource(ModelSQL, ModelView): states=STATES_WEB, depends=DEPENDS_WEB) rgxdecimal = fields.Selection( 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) rgxident = fields.Char( string='Identifier',