Add/improve some CORE member xref links
This commit is contained in:
parent
fcaa486e7f
commit
8e45b3fbf4
6 changed files with 72 additions and 13 deletions
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -48,6 +48,7 @@ class CustomerView(CoreOfficeMasterView):
|
|||
Base class for customer views.
|
||||
"""
|
||||
model_class = corepos.CustData
|
||||
model_key = ('card_number', 'person_number')
|
||||
model_title = "CORE-POS Customer (Legacy)"
|
||||
model_title_plural = "CORE-POS Customers (Legacy)"
|
||||
url_prefix = '/core-pos/customers'
|
||||
|
|
|
@ -92,6 +92,7 @@ class CoreMasterView(MasterView):
|
|||
Adds the URL for viewing the record/object within CORE Office, or else
|
||||
the reason for lack of such a URL.
|
||||
"""
|
||||
kwargs = super().template_kwargs_view(**kwargs)
|
||||
obj = kwargs['instance']
|
||||
|
||||
# CORE Office URL
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -26,7 +26,7 @@ CORE-POS member views
|
|||
|
||||
from corepos.db.office_op import model as corepos
|
||||
|
||||
from rattail_corepos.config import core_office_customer_account_url
|
||||
from rattail_corepos.config import core_office_url, core_office_customer_account_url
|
||||
|
||||
from webhelpers2.html import HTML, tags
|
||||
|
||||
|
@ -159,7 +159,9 @@ class MemberView(CoreOfficeMasterView):
|
|||
items = []
|
||||
for customer in customers:
|
||||
text = str(customer)
|
||||
url = self.request.route_url('corepos.customers.view', id=customer.id)
|
||||
url = self.request.route_url('corepos.customers.view',
|
||||
card_number=customer.card_number,
|
||||
person_number=customer.person_number)
|
||||
link = tags.link_to(text, url)
|
||||
items.append(HTML.tag('li', c=[link]))
|
||||
return HTML.tag('ul', c=items)
|
||||
|
@ -174,10 +176,14 @@ class MemberView(CoreOfficeMasterView):
|
|||
card_number=suspension.card_number)
|
||||
return tags.link_to(text, url)
|
||||
|
||||
def core_office_object_url(self, office_url, member):
|
||||
return core_office_customer_account_url(self.rattail_config,
|
||||
member.card_number,
|
||||
office_url=office_url)
|
||||
def get_xref_buttons(self, member):
|
||||
url = core_office_url(self.rattail_config)
|
||||
if url:
|
||||
url = core_office_customer_account_url(self.rattail_config,
|
||||
member.card_number,
|
||||
office_url=url)
|
||||
return [self.make_xref_button(url=url,
|
||||
text="View in CORE Office")]
|
||||
|
||||
|
||||
def defaults(config, **kwargs):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue