Use sku instead of upc when fetching CORE vendorItems record

since that is what API client now expects
This commit is contained in:
Lance Edgar 2021-02-09 16:12:32 -06:00
parent 83ba5c9ace
commit a72fd9ef77

View file

@ -129,9 +129,9 @@ class FromCOREAPIToRattail(NewDataSyncImportConsumer):
if change.payload_type == 'VendorItem': if change.payload_type == 'VendorItem':
fields = change.payload_key.split('|') fields = change.payload_key.split('|')
if len(fields) == 2: if len(fields) == 2:
upc, vendorID = fields sku, vendorID = fields
if vendorID.isdigit(): if vendorID.isdigit():
return self.api.get_vendor_item(upc, int(vendorID)) return self.api.get_vendor_item(sku, int(vendorID))
def get_product(self, change): def get_product(self, change):
if change.payload_type == 'Product': if change.payload_type == 'Product':
@ -139,9 +139,10 @@ class FromCOREAPIToRattail(NewDataSyncImportConsumer):
if change.payload_type == 'VendorItem': if change.payload_type == 'VendorItem':
fields = change.payload_key.split('|') fields = change.payload_key.split('|')
if len(fields) == 2: if len(fields) == 2:
upc, vendorID = fields sku, vendorID = fields
if upc: vendor_item = self.api.get_vendor_item(sku, vendorID)
return self.api.get_product(upc) if vendor_item:
return self.api.get_product(vendor_item['upc'])
class FromCOREPOSToRattailBase(NewDataSyncImportConsumer): class FromCOREPOSToRattailBase(NewDataSyncImportConsumer):