diff --git a/rattail_demo/web/templates/products/view.mako b/rattail_demo/web/templates/products/view.mako
new file mode 100644
index 0000000..7aacafc
--- /dev/null
+++ b/rattail_demo/web/templates/products/view.mako
@@ -0,0 +1,27 @@
+## -*- coding: utf-8; -*-
+<%inherit file="tailbone:templates/products/view.mako" />
+
+<%def name="object_helpers()">
+ ${parent.object_helpers()}
+ ${self.render_xref_helper()}
+%def>
+
+<%def name="render_xref_helper()">
+
+
Cross-Reference
+
+
+ View in CORE Office
+
+
+
+%def>
+
+
+${parent.body()}
diff --git a/rattail_demo/web/views/products.py b/rattail_demo/web/views/products.py
index 0c0ba19..0dae70e 100644
--- a/rattail_demo/web/views/products.py
+++ b/rattail_demo/web/views/products.py
@@ -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):