Don't duplicate transactions on import
This commit is contained in:
parent
e33f155d53
commit
3005cc1ae9
@ -30,16 +30,15 @@ def process_bank_csv(sender, signal, **kwargs):
|
|||||||
if key.startswith('VWZ'):
|
if key.startswith('VWZ'):
|
||||||
reference += line[key] + ' '
|
reference += line[key] + ' '
|
||||||
|
|
||||||
RealTransaction.objects.create(
|
RealTransaction.objects.get_or_create(
|
||||||
channel=TransactionChannel.BANK,
|
channel=TransactionChannel.BANK,
|
||||||
booking_datetime=booking_timestamp,
|
|
||||||
value_datetime=datetime.strptime(line.get('Buchungstag'), '%d.%m.%Y'),
|
value_datetime=datetime.strptime(line.get('Buchungstag'), '%d.%m.%Y'),
|
||||||
amount=Decimal(line.get('Betrag').replace('.', '').replace(',', '.')),
|
amount=Decimal(line.get('Betrag').replace('.', '').replace(',', '.')),
|
||||||
purpose=reference,
|
purpose=reference,
|
||||||
originator=line.get('Auftraggeber/Empfänger', '<leer>'),
|
originator=line.get('Auftraggeber/Empfänger', '<leer>'),
|
||||||
importer='shack_bank_csv_importer',
|
importer='shack_bank_csv_importer',
|
||||||
source=source,
|
|
||||||
data=line,
|
data=line,
|
||||||
|
defaults={'source': source, 'booking_datetime': booking_timestamp},
|
||||||
)
|
)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user