Add links to CORE Office for each customer account associated with a person

for use in "view profile" page, to open account in CORE Office
This commit is contained in:
Lance Edgar 2020-03-17 12:47:15 -05:00
parent 79c6829f3c
commit 099783ce62
2 changed files with 17 additions and 2 deletions

View file

@ -26,6 +26,8 @@ CORE POS customer views
from corepos.db.office_op import model as corepos from corepos.db.office_op import model as corepos
from rattail_corepos.config import core_office_customer_account_url
from .master import CoreOfficeMasterView from .master import CoreOfficeMasterView
@ -86,8 +88,9 @@ class CustomerView(CoreOfficeMasterView):
f.remove_field('last_change') f.remove_field('last_change')
def core_office_object_url(self, office_url, customer): def core_office_object_url(self, office_url, customer):
return '{}/mem/MemberEditor.php?memNum={}'.format( return core_office_customer_account_url(self.rattail_config,
office_url, customer.card_number) customer.card_number,
office_url=office_url)
def includeme(config): def includeme(config):

View file

@ -24,6 +24,8 @@
Person views Person views
""" """
from rattail_corepos.config import core_office_customer_account_url
from tailbone.views import people as base from tailbone.views import people as base
@ -59,3 +61,13 @@ class PersonView(base.PeopleView):
super(PersonView, self).configure_form(f) super(PersonView, self).configure_form(f)
f.append('corepos_customer_id') f.append('corepos_customer_id')
def get_context_customers(self, person):
data = super(PersonView, self).get_context_customers(person)
# add CORE Office URL for each customer account
for customer in data:
customer['view_corepos_url'] = core_office_customer_account_url(
self.rattail_config, customer['number'])
return data