From 4a03a7f57d52812339e2f181e2b736dc58a676b5 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 31 Mar 2020 23:11:46 -0500 Subject: [PATCH] Dang it, use datetime instead of date, for that sorting hack --- .../corepos/importing/db/exporters/catapult_inventory.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py b/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py index 090e16d..3965c42 100644 --- a/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py +++ b/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py @@ -119,7 +119,7 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo super(InventoryItemImporter, self).setup() # this is used for sorting, when a value has no date - self.old_date = datetime.date(1900, 1, 1) + self.old_datetime = datetime.datetime(1900, 1, 1) self.ignored_upcs = self.config.getlist( 'corepos', 'exporting.catapult_inventory.ignored_upcs') @@ -345,7 +345,7 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo product.upc, len(vendor_items), product) # sort the list so most recently modified is first - vendor_items.sort(key=lambda item: item.modified or self.old_date, + vendor_items.sort(key=lambda item: item.modified or self.old_datetime, reverse=True) # use the "first" vendor item available