Add datasync support for CORE VendorItem -> ProductCost
This commit is contained in:
parent
580f2093ae
commit
aff04035ff
2 changed files with 12 additions and 1 deletions
|
@ -37,6 +37,9 @@ class FromCOREAPIToRattail(NewDataSyncImportConsumer):
|
|||
Consumer for CORE POS (API) -> Rattail datasync
|
||||
"""
|
||||
handler_spec = 'rattail_corepos.importing.corepos.api:FromCOREPOSToRattail'
|
||||
model_map = {
|
||||
'VendorItem': 'ProductCost',
|
||||
}
|
||||
|
||||
def setup(self):
|
||||
super(FromCOREAPIToRattail, self).setup()
|
||||
|
@ -82,6 +85,7 @@ class FromCOREAPIToRattail(NewDataSyncImportConsumer):
|
|||
'Subdepartment',
|
||||
'Vendor',
|
||||
'Product',
|
||||
'VendorItem',
|
||||
]
|
||||
for change in [c for c in changes if c.payload_type in types]:
|
||||
self.invoke_importer(session, change)
|
||||
|
@ -97,6 +101,12 @@ class FromCOREAPIToRattail(NewDataSyncImportConsumer):
|
|||
return self.api.get_vendor(change.payload_key)
|
||||
if change.payload_type == 'Product':
|
||||
return self.api.get_product(change.payload_key)
|
||||
if change.payload_type == 'VendorItem':
|
||||
fields = change.payload_key.split('|')
|
||||
if len(fields) == 2:
|
||||
upc, vendorID = fields
|
||||
if vendorID.isdigit():
|
||||
return self.api.get_vendor_item(upc, int(vendorID))
|
||||
|
||||
|
||||
class FromCOREPOSToRattailBase(NewDataSyncImportConsumer):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue