diff options
| author | Magnus Hagander | 2020-03-29 15:04:46 +0000 |
|---|---|---|
| committer | Magnus Hagander | 2020-03-29 15:06:49 +0000 |
| commit | 5df9002dc6133fff57b92ce31f163c52381109ac (patch) | |
| tree | 81ab05668a5c518baf7faa073b73bbc81b0a6a8e /postgresqleu/transferwise | |
| parent | faf8f525c7516b896e559e8aad385eed3f226a6c (diff) | |
Remove date parameter to create_accounting_entry
This should always be set to todays date, so set it in the function
instaed.
This changes the behaviour of the paypal plugin to actually use todays
date rather than a date parsed out from the notification. In theory this
could change the accounting entry date in case the notification is so
delayed it ends up on a different day, but either one could be argued to
be equally correct in this case, and using the date of creation of the
transaction makes tracking things a lot easier.
While at it, clean up some imports that have been missed earlier.
Diffstat (limited to 'postgresqleu/transferwise')
| -rw-r--r-- | postgresqleu/transferwise/management/commands/transferwise_fetch_transactions.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/postgresqleu/transferwise/management/commands/transferwise_fetch_transactions.py b/postgresqleu/transferwise/management/commands/transferwise_fetch_transactions.py index f3f99783..8c0213ca 100644 --- a/postgresqleu/transferwise/management/commands/transferwise_fetch_transactions.py +++ b/postgresqleu/transferwise/management/commands/transferwise_fetch_transactions.py @@ -16,7 +16,7 @@ from postgresqleu.invoices.models import InvoicePaymentMethod from postgresqleu.transferwise.models import TransferwiseTransaction, TransferwiseRefund from postgresqleu.transferwise.models import TransferwisePayout -from datetime import datetime, timedelta, date +from datetime import timedelta import re @@ -127,7 +127,7 @@ class Command(BaseCommand): (pm.config('feeaccount'), accountingtxt, trans.feeamount, None), (pm.config('bankaccount'), accountingtxt, -(trans.amount + trans.feeamount), None), ] - create_accounting_entry(date.today(), accrows) + create_accounting_entry(accrows) elif trans.transtype == 'TRANSFER' and trans.paymentref.startswith('TW payout'): # Payout. Create an appropriate accounting record and a pending matcher. try: @@ -153,13 +153,13 @@ class Command(BaseCommand): (pm.config('accounting_payout'), trans.paymentref, -(trans.amount + trans.feeamount), None), ] if is_managed_bank_account(pm.config('accounting_payout')): - entry = create_accounting_entry(date.today(), accrows, True) + entry = create_accounting_entry(accrows, True) register_pending_bank_matcher(pm.config('accounting_payout'), '.*TW.*payout.*{0}.*'.format(refno), -(trans.amount + trans.feeamount), entry) else: - create_accounting_entry(date.today(), accrows) + create_accounting_entry(accrows) else: # Else register a pending bank transaction. This may immediately match an invoice # if it was an invoice payment, in which case the entire process will copmlete. |
