Add schema, logic for importing CORE VendorItem -> ProductCost
This commit is contained in:
parent
b96a4bc7b9
commit
580f2093ae
5 changed files with 200 additions and 1 deletions
|
@ -107,3 +107,22 @@ class ProductImporter(importing.model.ProductImporter):
|
|||
.filter(model.CoreProduct.corepos_id != None)
|
||||
|
||||
return query
|
||||
|
||||
|
||||
class ProductCostImporter(importing.model.ProductCostImporter):
|
||||
|
||||
extension_attr = '_corepos'
|
||||
extension_fields = [
|
||||
'corepos_id',
|
||||
]
|
||||
|
||||
def cache_query(self):
|
||||
query = super(ProductCostImporter, self).cache_query()
|
||||
model = self.config.get_model()
|
||||
|
||||
# we want to ignore items with no CORE ID, if that's (part of) our key
|
||||
if 'corepos_id' in self.key:
|
||||
query = query.join(model.CoreProductCost)\
|
||||
.filter(model.CoreProductCost.corepos_id != None)
|
||||
|
||||
return query
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue