diff --git a/tailbone/static/files/vendor_catalog_template.xlsx b/tailbone/static/files/vendor_catalog_template.xlsx new file mode 100644 index 00000000..f68be31d Binary files /dev/null and b/tailbone/static/files/vendor_catalog_template.xlsx differ diff --git a/tailbone/templates/batch/vendorcatalog/configure.mako b/tailbone/templates/batch/vendorcatalog/configure.mako new file mode 100644 index 00000000..e4fa346a --- /dev/null +++ b/tailbone/templates/batch/vendorcatalog/configure.mako @@ -0,0 +1,9 @@ +## -*- coding: utf-8; -*- +<%inherit file="/configure.mako" /> + +<%def name="form_content()"> + ${self.input_file_templates_section()} + + + +${parent.body()} diff --git a/tailbone/templates/batch/vendorcatalog/index.mako b/tailbone/templates/batch/vendorcatalog/index.mako index 1fac1170..fa6e4a5a 100644 --- a/tailbone/templates/batch/vendorcatalog/index.mako +++ b/tailbone/templates/batch/vendorcatalog/index.mako @@ -3,9 +3,6 @@ <%def name="context_menu_items()"> ${parent.context_menu_items()} - % if generic_template_url and master.has_perm('create'): -
  • ${h.link_to("Download Generic Template", generic_template_url)}
  • - % endif % if h.route_exists(request, 'vendors') and request.has_perm('vendors.list'):
  • ${h.link_to("View Vendors", url('vendors'))}
  • % endif diff --git a/tailbone/views/batch/vendorcatalog.py b/tailbone/views/batch/vendorcatalog.py index 7a1a4153..5436f7d7 100644 --- a/tailbone/views/batch/vendorcatalog.py +++ b/tailbone/views/batch/vendorcatalog.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2021 Lance Edgar +# Copyright © 2010-2022 Lance Edgar # # This file is part of Rattail. # @@ -57,6 +57,8 @@ class VendorCatalogView(FileBatchMasterView): template_prefix = '/batch/vendorcatalog' editable = False rows_bulk_deletable = True + has_input_file_templates = True + configurable = True labels = { 'vendor_id': "Vendor ID", @@ -133,6 +135,14 @@ class VendorCatalogView(FileBatchMasterView): 'status_text', ] + def get_input_file_templates(self): + return [ + {'key': 'default', + 'label': "Default", + 'default_url': self.request.static_url( + 'tailbone:static/files/vendor_catalog_template.xlsx')}, + ] + def get_parsers(self): if not hasattr(self, 'parsers'): parsers = sorted(iter_catalog_parsers(), key=lambda p: p.display) @@ -252,11 +262,6 @@ class VendorCatalogView(FileBatchMasterView): f.set_type('upc', 'gpc') f.set_type('discount_percent', 'percent') - def template_kwargs_index(self, **kwargs): - url = self.rattail_config.get('tailbone', 'batch.vendorcatalog.generic_template_url') - kwargs['generic_template_url'] = url - return kwargs - def template_kwargs_create(self, **kwargs): parsers = self.get_parsers() for parser in parsers: