fix: improve logic for matching CORE stock purchase to Rattail payment
we were already "trying" to match on date only, but only as a sort of fallback. now we still try "exact" date/time match first but then also an explicit date match, before other fallback logic
This commit is contained in:
parent
666fb747bb
commit
57d3a21e43
|
@ -953,7 +953,17 @@ class MemberEquityPaymentImporter(FromCOREPOS, corepos_importing.model.MemberEqu
|
|||
if len(match) == 1:
|
||||
return match[0]
|
||||
|
||||
# nb. avoid datetime for this one
|
||||
# then try to match on date only, not time
|
||||
match = [payment for payment in payments
|
||||
if payment.corepos_transaction_number == stock_purchase.transaction_number
|
||||
and payment.corepos_transaction_id == stock_purchase.transaction_id
|
||||
and payment.amount == stock_purchase.amount
|
||||
and payment.corepos_department_number == stock_purchase.department_number
|
||||
and self.app.localtime(payment.corepos_datetime, from_utc=True).date() == dt.date()]
|
||||
if len(match) == 1:
|
||||
return match[0]
|
||||
|
||||
# nb. avoid date/time for this one
|
||||
matches = [payment for payment in payments
|
||||
if payment.corepos_transaction_number == stock_purchase.transaction_number
|
||||
and payment.corepos_transaction_id == stock_purchase.transaction_id
|
||||
|
@ -966,6 +976,9 @@ class MemberEquityPaymentImporter(FromCOREPOS, corepos_importing.model.MemberEqu
|
|||
stock_purchase.amount,
|
||||
stock_purchase.datetime)
|
||||
|
||||
# TODO: now that we try to match on date above, this logic
|
||||
# may no longer be necssary/useful?
|
||||
|
||||
# so there is one match, but its timestamp may be way off,
|
||||
# so let's also make sure at least date matches
|
||||
payment = matches[0]
|
||||
|
|
Loading…
Reference in a new issue