Add jump button, to view product in CORE Office
This commit is contained in:
parent
72a4c347d8
commit
d7462f415d
2 changed files with 49 additions and 2 deletions
|
@ -1,9 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8; -*-
|
||||
"""
|
||||
Product views
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
from rattail_corepos.config import core_office_url
|
||||
|
||||
from tailbone.views import products as base
|
||||
|
||||
|
@ -55,6 +55,26 @@ class ProductsView(base.ProductsView):
|
|||
'deleted',
|
||||
]
|
||||
|
||||
def template_kwargs_view(self, **kwargs):
|
||||
"""
|
||||
Supplements the default logic as follows:
|
||||
|
||||
Adds the URL for viewing the product within CORE Office, or else the
|
||||
reason for lack of such a URL.
|
||||
"""
|
||||
kwargs = super(ProductsView, self).template_kwargs_view(**kwargs)
|
||||
product = kwargs['instance']
|
||||
|
||||
# CORE Office URL
|
||||
kwargs['core_office_url'] = None
|
||||
office_url = core_office_url(self.rattail_config)
|
||||
if not office_url:
|
||||
kwargs['core_office_why_no_url'] = "CORE Office URL is not configured!"
|
||||
else:
|
||||
kwargs['core_office_url'] = '{}/item/ItemEditorPage.php?searchupc={}'.format(office_url, product.item_id)
|
||||
|
||||
return kwargs
|
||||
|
||||
|
||||
def includeme(config):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue