[import] do not import inflow virtual transactions, which can't be matched
This commit is contained in:
parent
f69cdfa754
commit
eba314ee3e
@ -98,13 +98,9 @@ def _import_inflows(member, virtual_transactions, real_transactions):
|
|||||||
value_datetime=localize(parse_date(inflow['due_date'])),
|
value_datetime=localize(parse_date(inflow['due_date'])),
|
||||||
purpose=inflow['payment_reference'],
|
purpose=inflow['payment_reference'],
|
||||||
)
|
)
|
||||||
if not possible_real_transaction.exists():
|
|
||||||
real_transaction = None
|
if possible_real_transaction.count() == 1:
|
||||||
elif possible_real_transaction.count() == 1:
|
|
||||||
real_transaction = possible_real_transaction.first()
|
real_transaction = possible_real_transaction.first()
|
||||||
else:
|
|
||||||
real_transaction = possible_real_transaction.first()
|
|
||||||
print(f'Found more than one transactions matching our query: {possible_real_transaction.values_list("pk", flat=True)}')
|
|
||||||
|
|
||||||
VirtualTransaction.objects.create(
|
VirtualTransaction.objects.create(
|
||||||
destination_account=account,
|
destination_account=account,
|
||||||
@ -114,6 +110,10 @@ def _import_inflows(member, virtual_transactions, real_transactions):
|
|||||||
value_datetime=localize(parse_date(inflow['due_date'])),
|
value_datetime=localize(parse_date(inflow['due_date'])),
|
||||||
real_transaction=real_transaction,
|
real_transaction=real_transaction,
|
||||||
)
|
)
|
||||||
|
elif possible_real_transaction.count() == 0:
|
||||||
|
print(f'Found no transaction matching our query: {inflow}')
|
||||||
|
elif possible_real_transaction.count() > 1:
|
||||||
|
print(f'Found more than one transactions matching our query: {possible_real_transaction.values_list("pk", flat=True)}')
|
||||||
|
|
||||||
|
|
||||||
def _import_transactions(member_data, member):
|
def _import_transactions(member_data, member):
|
||||||
|
Loading…
Reference in New Issue
Block a user