Use handler to get CORE Office URLs
instead of deprecated config function
This commit is contained in:
parent
0b7f3d8dcc
commit
045940d4fa
13 changed files with 66 additions and 82 deletions
|
@ -26,8 +26,6 @@ CORE POS customer views
|
|||
|
||||
from corepos.db.office_op import model as corepos
|
||||
|
||||
from rattail_corepos.config import core_office_customer_account_url
|
||||
|
||||
from webhelpers2.html import tags
|
||||
|
||||
from .master import CoreOfficeMasterView
|
||||
|
@ -146,9 +144,9 @@ class CustomerClassicView(CoreOfficeMasterView):
|
|||
return render_member_info(self.request, custdata, field)
|
||||
|
||||
def core_office_object_url(self, office_url, customer):
|
||||
return core_office_customer_account_url(self.rattail_config,
|
||||
customer.card_number,
|
||||
office_url=office_url)
|
||||
app = self.get_rattail_app()
|
||||
corepos = app.get_corepos_handler()
|
||||
return corepos.get_office_member_url(customer.card_number)
|
||||
|
||||
def download_results_fields_available(self, **kwargs):
|
||||
fields = super().download_results_fields_available(**kwargs)
|
||||
|
|
|
@ -26,9 +26,6 @@ CORE POS master view
|
|||
|
||||
from collections import OrderedDict
|
||||
|
||||
from rattail.time import localtime
|
||||
from rattail_corepos.config import core_office_url
|
||||
|
||||
from webhelpers2.html import tags
|
||||
|
||||
from tailbone.views import MasterView
|
||||
|
@ -114,11 +111,13 @@ class CoreMasterView(MasterView):
|
|||
the reason for lack of such a URL.
|
||||
"""
|
||||
kwargs = super().template_kwargs_view(**kwargs)
|
||||
app = self.get_rattail_app()
|
||||
corepos = app.get_corepos_handler()
|
||||
obj = kwargs['instance']
|
||||
|
||||
# CORE Office URL
|
||||
kwargs['core_office_url'] = None
|
||||
office_url = core_office_url(self.rattail_config)
|
||||
office_url = corepos.get_office_url()
|
||||
if not office_url:
|
||||
kwargs['core_office_why_no_url'] = "CORE Office URL is not configured"
|
||||
else:
|
||||
|
|
|
@ -29,8 +29,6 @@ from sqlalchemy import orm
|
|||
from corepos.db.office_op import model as corepos
|
||||
from corepos.db.office_trans import model as coretrans
|
||||
|
||||
from rattail_corepos.config import core_office_url, core_office_customer_account_url
|
||||
|
||||
from webhelpers2.html import HTML, tags
|
||||
|
||||
from tailbone_corepos.db import CoreTransSession
|
||||
|
@ -210,13 +208,11 @@ class MemberView(CoreOfficeMasterView):
|
|||
return app.render_currency(balance.payments)
|
||||
|
||||
def get_xref_buttons(self, member):
|
||||
url = core_office_url(self.rattail_config)
|
||||
app = self.get_rattail_app()
|
||||
corepos = app.get_corepos_handler()
|
||||
url = corepos.get_office_member_url(member.card_number)
|
||||
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")]
|
||||
return [self.make_xref_button(url=url, text="View in CORE Office")]
|
||||
|
||||
def get_row_data(self, member):
|
||||
return CoreTransSession.query(coretrans.StockPurchase)\
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue