formatting, indexes optimized

This commit is contained in:
Frederik Jaeckel 2023-11-29 15:19:38 +01:00
parent 77ee7d15b7
commit 7220cff5ac
12 changed files with 124 additions and 126 deletions

View file

@ -31,20 +31,19 @@ class SecondCurrencyMixin:
states={
'readonly': Or(
STATES['readonly'],
~Bool(Eval('currency2nd'))
),
~Bool(Eval('currency2nd'))),
'required': Bool(Eval('currency2nd')),
'invisible': ~Bool(Eval('currency2nd')),
}, depends=DEPENDS+['currency2nd_digits', 'currency2nd'])
rate_2nd_currency = fields.Function(fields.Numeric(
string='Rate',
help='Exchange rate between the currencies of the participating cashbooks.',
help='Exchange rate between the currencies of the ' +
'participating cashbooks.',
digits=(rate_decimal * 2, rate_decimal),
states={
'readonly': Or(
STATES['readonly'],
~Bool(Eval('currency2nd'))
),
~Bool(Eval('currency2nd'))),
'required': Bool(Eval('currency2nd')),
'invisible': ~Bool(Eval('currency2nd')),
}, depends=DEPENDS+['currency2nd_digits', 'currency2nd']),
@ -124,15 +123,13 @@ class SecondCurrencyMixin:
self.amount_2nd_currency = Currency.compute(
self.currency,
self.amount,
self.booktransf.currency
)
self.booktransf.currency)
if self.amount != Decimal('0.0'):
self.rate_2nd_currency = \
self.amount_2nd_currency / self.amount
else:
self.amount_2nd_currency = self.booktransf.currency.round(
self.amount * self.rate_2nd_currency
)
self.amount * self.rate_2nd_currency)
@classmethod
def set_rate_2nd_currency(cls, lines, name, value):