diff --git a/rattail_corepos/importing/corepos/db.py b/rattail_corepos/importing/corepos/db.py index 63b6894..59d4b0e 100644 --- a/rattail_corepos/importing/corepos/db.py +++ b/rattail_corepos/importing/corepos/db.py @@ -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]