diff --git a/rattail_corepos/importing/corepos/db.py b/rattail_corepos/importing/corepos/db.py index b9d7a3b..7957e8d 100644 --- a/rattail_corepos/importing/corepos/db.py +++ b/rattail_corepos/importing/corepos/db.py @@ -285,6 +285,17 @@ class MemberEquityPaymentImporter(FromCOREPOS, corepos_importing.model.MemberEqu query=query, key=key) + def cache_query(self): + query = super().cache_query() + model = self.model + + # ignore existing payments not known to be in CORE + # TODO: is this in fact a good idea? + query = query.join(model.CoreMemberEquityPayment)\ + .filter(model.CoreMemberEquityPayment.corepos_transaction_number != None) + + return query + def get_member(self, card_number): if hasattr(self, 'members_by_card_number'): return self.members_by_card_number.get(card_number)