From 07a36982d7dd179524279ee388f18a1affd77ff8 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 14 Mar 2020 19:50:35 -0500 Subject: [PATCH] Move jump button logic to tailbone-corepos since that now supports jump button for Vendor also, maybe others to come --- rattail_demo/web/app.py | 1 + rattail_demo/web/templates/products/view.mako | 27 ----------------- rattail_demo/web/views/products.py | 29 +++---------------- 3 files changed, 5 insertions(+), 52 deletions(-) delete mode 100644 rattail_demo/web/templates/products/view.mako diff --git a/rattail_demo/web/app.py b/rattail_demo/web/app.py index 3efd877..e6e9895 100644 --- a/rattail_demo/web/app.py +++ b/rattail_demo/web/app.py @@ -15,6 +15,7 @@ def main(global_config, **settings): """ # prefer demo templates over tailbone settings.setdefault('mako.directories', ['rattail_demo.web:templates', + 'tailbone_corepos:templates', 'tailbone:templates',]) # for graceful handling of postgres restart diff --git a/rattail_demo/web/templates/products/view.mako b/rattail_demo/web/templates/products/view.mako deleted file mode 100644 index 7aacafc..0000000 --- a/rattail_demo/web/templates/products/view.mako +++ /dev/null @@ -1,27 +0,0 @@ -## -*- coding: utf-8; -*- -<%inherit file="tailbone:templates/products/view.mako" /> - -<%def name="object_helpers()"> - ${parent.object_helpers()} - ${self.render_xref_helper()} - - -<%def name="render_xref_helper()"> -
-

Cross-Reference

-
- - View in CORE Office - -
-
- - - -${parent.body()} diff --git a/rattail_demo/web/views/products.py b/rattail_demo/web/views/products.py index 0dae70e..376a96c 100644 --- a/rattail_demo/web/views/products.py +++ b/rattail_demo/web/views/products.py @@ -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)