add test for non-asset usd/eur,

todo test for asset-usd
This commit is contained in:
Frederik Jaeckel 2024-03-04 22:36:50 +01:00
parent ce0b9ff946
commit 9c40e8990a
2 changed files with 168 additions and 3 deletions

View file

@ -513,17 +513,29 @@ class ScheduledBooking(DeactivableMixin, ModelSQL, ModelView):
elif record.bookingtype in ['mvin', 'mvout']:
if record.booktransf:
line['booktransf'] = record.booktransf.id
if record.booktransf.feature == 'asset':
# add 2nd currency if currencies are different
line = Line.add_2nd_currency(
line, record.booktransf.currency)
print('-- line-1:', line)
if record.booktransf.current_rate:
line['quantity'] = (line.get(
'amount_2nd_currency', record.amount) /
record.booktransf.asset.rate)
print('-- line-2:', line)
if record.wfcheck:
to_create_check.append(line)
else:
to_create.append(line)
if to_create_check:
print('-- to_create_check:', to_create_check)
lines = Line.create(to_create_check)
Line.wfcheck(lines)
if to_create:
print('-- to_create:', to_create)
Line.create(to_create)
@classmethod