Add set_vendor_item() method for API client
				
					
				
			This commit is contained in:
		
							parent
							
								
									1757d09781
								
							
						
					
					
						commit
						76f743f3b8
					
				
					 1 changed files with 24 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
################################################################################
 | 
			
		||||
#
 | 
			
		||||
#  pyCOREPOS -- Python Interface to CORE POS
 | 
			
		||||
#  Copyright © 2018-2020 Lance Edgar
 | 
			
		||||
#  Copyright © 2018-2021 Lance Edgar
 | 
			
		||||
#
 | 
			
		||||
#  This file is part of pyCOREPOS.
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			@ -487,3 +487,26 @@ class CoreWebAPI(object):
 | 
			
		|||
            if len(result) > 1:
 | 
			
		||||
                log.warning("CORE API returned %s VendorItem results", len(result))
 | 
			
		||||
            return json.loads(result[0])
 | 
			
		||||
 | 
			
		||||
    def set_vendor_item(self, sku, vendorID, **columns):
 | 
			
		||||
        """
 | 
			
		||||
        Update an existing VendorItem record in CORE.
 | 
			
		||||
 | 
			
		||||
        :returns: Boolean indicating success of the operation.
 | 
			
		||||
 | 
			
		||||
        .. note::
 | 
			
		||||
           Currently this is being used to create a *new* product also.  CORE's
 | 
			
		||||
           ``vendorItems`` table does not use auto-increment for its PK, which
 | 
			
		||||
           means we must provide one even when creating; therefore this method
 | 
			
		||||
           may be used for that.
 | 
			
		||||
        """
 | 
			
		||||
        columns['sku'] = sku
 | 
			
		||||
        columns['vendorID'] = vendorID
 | 
			
		||||
        params = {
 | 
			
		||||
            'entity': 'VendorItems',
 | 
			
		||||
            'submethod': 'set',
 | 
			
		||||
            'columns': columns,
 | 
			
		||||
        }
 | 
			
		||||
        response = self.post(params)
 | 
			
		||||
        result = self.parse_response(response)
 | 
			
		||||
        return json.loads(result)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue