Add view supplement for CustomerShopper
This commit is contained in:
		
							parent
							
								
									b896e30409
								
							
						
					
					
						commit
						15d4086da2
					
				
					 1 changed files with 29 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -75,5 +75,34 @@ class CustomerViewSupplement(ViewSupplement):
 | 
			
		|||
            return [tags.link_to("View CORE-POS Member", url)]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class CustomerShopperViewSupplement(ViewSupplement):
 | 
			
		||||
    """
 | 
			
		||||
    CustomerShopper view supplement for CORE integration
 | 
			
		||||
    """
 | 
			
		||||
    route_prefix = 'customer_shoppers'
 | 
			
		||||
 | 
			
		||||
    labels = {
 | 
			
		||||
        'corepos_customer_id': "CORE-POS Customer ID",
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    def get_grid_query(self, query):
 | 
			
		||||
        model = self.model
 | 
			
		||||
        return query.outerjoin(model.CoreCustomerShopper)
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
        model = self.model
 | 
			
		||||
        g.append('corepos_customer_id')
 | 
			
		||||
        g.set_filter('corepos_customer_id', model.CoreCustomerShopper.corepos_customer_id)
 | 
			
		||||
 | 
			
		||||
    def configure_form(self, f):
 | 
			
		||||
        if not self.master.creating:
 | 
			
		||||
            f.append('corepos_customer_id')
 | 
			
		||||
 | 
			
		||||
    def get_version_child_classes(self):
 | 
			
		||||
        model = self.model
 | 
			
		||||
        return [model.CoreCustomerShopper]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def includeme(config):
 | 
			
		||||
    CustomerViewSupplement.defaults(config)
 | 
			
		||||
    CustomerShopperViewSupplement.defaults(config)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue