Move jump button logic to tailbone-corepos

since that now supports jump button for Vendor also, maybe others to come
This commit is contained in:
Lance Edgar 2020-03-14 19:50:35 -05:00
parent d7462f415d
commit 07a36982d7
3 changed files with 5 additions and 52 deletions

View file

@ -3,18 +3,17 @@
Product views
"""
from rattail_corepos.config import core_office_url
from tailbone.views import products as base
from tailbone_corepos.views import products as corepos_base
class ProductsView(base.ProductsView):
class ProductView(corepos_base.ProductView):
"""
Product overrides for online demo
"""
def configure_form(self, f):
super(ProductsView, self).configure_form(f)
super(ProductView, self).configure_form(f)
if self.editing:
f.fields = [
@ -55,26 +54,6 @@ 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):
@ -86,4 +65,4 @@ def includeme(config):
config.add_view(base.print_labels, route_name='products.print_labels',
renderer='json', permission='products.print_labels')
ProductsView.defaults(config)
ProductView.defaults(config)