diff --git a/tailbone/views/customers.py b/tailbone/views/customers.py index 99e2a6b2..1ac1a2ad 100644 --- a/tailbone/views/customers.py +++ b/tailbone/views/customers.py @@ -28,6 +28,7 @@ from __future__ import unicode_literals, absolute_import import re +import six import sqlalchemy as sa from sqlalchemy import orm @@ -54,6 +55,7 @@ class CustomersView(MasterView): 'id': "ID", 'default_phone': "Phone Number", 'default_email': "Email Address", + 'default_address': "Physical Address", 'active_in_pos': "Active in POS", 'active_in_pos_sticky': "Always Active in POS", } @@ -71,6 +73,7 @@ class CustomersView(MasterView): 'name', 'default_phone', 'default_email', + 'default_address', 'email_preference', 'active_in_pos', 'active_in_pos_sticky', @@ -157,6 +160,9 @@ class CustomersView(MasterView): if not self.creating and customer.phones: f.set_default('default_phone', customer.phones[0].number) + f.set_renderer('default_address', self.render_default_address) + f.set_readonly('default_address') + f.set_enum('email_preference', self.enum.EMAIL_PREFERENCE) preferences = list(self.enum.EMAIL_PREFERENCE.items()) preferences.insert(0, ('', "(no preference)")) @@ -205,6 +211,10 @@ class CustomersView(MasterView): if customer.phones: return customer.phones[0].number + def render_default_address(self, customer, field): + if customer.addresses: + return six.text_type(customer.addresses[0]) + def render_people(self, customer, field): people = customer.people if not people: