Expose default email address, phone number when editing a Person

This commit is contained in:
Lance Edgar 2020-03-17 18:50:07 -05:00
parent ff3e83b1c5
commit 8ac0bb2334
4 changed files with 55 additions and 13 deletions

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2019 Lance Edgar
# Copyright © 2010-2020 Lance Edgar
#
# This file is part of Rattail.
#
@ -847,6 +847,20 @@ class MasterView(View):
'importer_host_title': importer_host_title,
})
def render_default_phone(self, obj, field):
"""
Render the "default" (first) phone number for the given contact.
"""
if obj.phones:
return obj.phones[0].number
def render_default_email(self, obj, field):
"""
Render the "default" (first) email address for the given contact.
"""
if obj.emails:
return obj.emails[0].address
def render_product_key_value(self, obj):
"""
Render the "canonical" product key value for the given object.