Declare "is contact" for the Customers view
removes some duplicated code. also this adds CustomerNote to version history
This commit is contained in:
		
							parent
							
								
									6a57e51f6b
								
							
						
					
					
						commit
						19080924d5
					
				
					 1 changed files with 2 additions and 7 deletions
				
			
		| 
						 | 
					@ -49,6 +49,7 @@ class CustomersView(MasterView):
 | 
				
			||||||
    Master view for the Customer class.
 | 
					    Master view for the Customer class.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    model_class = model.Customer
 | 
					    model_class = model.Customer
 | 
				
			||||||
 | 
					    is_contact = True
 | 
				
			||||||
    has_versions = True
 | 
					    has_versions = True
 | 
				
			||||||
    supports_mobile = True
 | 
					    supports_mobile = True
 | 
				
			||||||
    people_detachable = True
 | 
					    people_detachable = True
 | 
				
			||||||
| 
						 | 
					@ -252,13 +253,6 @@ class CustomersView(MasterView):
 | 
				
			||||||
        if query.count():
 | 
					        if query.count():
 | 
				
			||||||
            raise colander.Invalid(node, "Customer ID must be unique")
 | 
					            raise colander.Invalid(node, "Customer ID must be unique")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def objectify(self, form, data=None):
 | 
					 | 
				
			||||||
        if data is None:
 | 
					 | 
				
			||||||
            data = form.validated
 | 
					 | 
				
			||||||
        customer = super(CustomersView, self).objectify(form, data)
 | 
					 | 
				
			||||||
        customer = self.objectify_contact(customer, data)
 | 
					 | 
				
			||||||
        return customer
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def render_default_email(self, customer, field):
 | 
					    def render_default_email(self, customer, field):
 | 
				
			||||||
        if customer.emails:
 | 
					        if customer.emails:
 | 
				
			||||||
            return customer.emails[0].address
 | 
					            return customer.emails[0].address
 | 
				
			||||||
| 
						 | 
					@ -346,6 +340,7 @@ class CustomersView(MasterView):
 | 
				
			||||||
            (model.CustomerEmailAddress, 'parent_uuid'),
 | 
					            (model.CustomerEmailAddress, 'parent_uuid'),
 | 
				
			||||||
            (model.CustomerMailingAddress, 'parent_uuid'),
 | 
					            (model.CustomerMailingAddress, 'parent_uuid'),
 | 
				
			||||||
            (model.CustomerPerson, 'customer_uuid'),
 | 
					            (model.CustomerPerson, 'customer_uuid'),
 | 
				
			||||||
 | 
					            (model.CustomerNote, 'parent_uuid'),
 | 
				
			||||||
        ]
 | 
					        ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def detach_person(self):
 | 
					    def detach_person(self):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue