Declare "is contact" for the Customers view

removes some duplicated code.  also this adds CustomerNote to version history
This commit is contained in:
Lance Edgar 2019-02-19 20:14:10 -06:00
parent 6a57e51f6b
commit 19080924d5

View file

@ -49,6 +49,7 @@ class CustomersView(MasterView):
Master view for the Customer class.
"""
model_class = model.Customer
is_contact = True
has_versions = True
supports_mobile = True
people_detachable = True
@ -252,13 +253,6 @@ class CustomersView(MasterView):
if query.count():
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):
if customer.emails:
return customer.emails[0].address
@ -346,6 +340,7 @@ class CustomersView(MasterView):
(model.CustomerEmailAddress, 'parent_uuid'),
(model.CustomerMailingAddress, 'parent_uuid'),
(model.CustomerPerson, 'customer_uuid'),
(model.CustomerNote, 'parent_uuid'),
]
def detach_person(self):