diff --git a/splitline.py b/splitline.py index a3831c2..649c5f3 100644 --- a/splitline.py +++ b/splitline.py @@ -106,14 +106,14 @@ class SplitLine(ModelSQL, ModelView): '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 cashbook to 'to_currency' """ Currency = Pool().get('currency.currency') values = { - 'amount': self.amount, + 'amount': amount if amount is not None else self.amount, } if to_currency.id != self.line.cashbook.currency.id: @@ -122,7 +122,7 @@ class SplitLine(ModelSQL, ModelView): }): values['amount'] = Currency.compute( self.line.cashbook.currency, - self.amount, + values['amount'], to_currency) return values