formatting, indexes optimized
This commit is contained in:
parent
510357a13c
commit
9ee924f0d8
11 changed files with 90 additions and 94 deletions
15
mixin.py
15
mixin.py
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue