splitline: parameter fix

This commit is contained in:
Frederik Jaeckel 2022-09-29 21:10:15 +02:00
parent b6799e355f
commit 4a7ee23e2c

View file

@ -106,14 +106,14 @@ class SplitLine(ModelSQL, ModelView):
'type': gettext('cashbook.msg_line_bookingtype_%s' % self.line.bookingtype), 'type': gettext('cashbook.msg_line_bookingtype_%s' % self.line.bookingtype),
} }
def get_amount_by_second_currency(self, to_currency): def get_amount_by_second_currency(self, to_currency, amount=None):
""" get amount, calculate credit/debit from currency of current """ get amount, calculate credit/debit from currency of current
cashbook to 'to_currency' cashbook to 'to_currency'
""" """
Currency = Pool().get('currency.currency') Currency = Pool().get('currency.currency')
values = { values = {
'amount': self.amount, 'amount': amount if amount is not None else self.amount,
} }
if to_currency.id != self.line.cashbook.currency.id: if to_currency.id != self.line.cashbook.currency.id:
@ -122,7 +122,7 @@ class SplitLine(ModelSQL, ModelView):
}): }):
values['amount'] = Currency.compute( values['amount'] = Currency.compute(
self.line.cashbook.currency, self.line.cashbook.currency,
self.amount, values['amount'],
to_currency) to_currency)
return values return values