From f89dc88c0eb3276d4765ce3244efc47163807885 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 6 Jan 2022 12:53:01 -0600 Subject: [PATCH] Add configurable template file for vendor catalog batch --- .../static/files/vendor_catalog_template.xlsx | Bin 0 -> 7593 bytes .../batch/vendorcatalog/configure.mako | 9 +++++++++ .../templates/batch/vendorcatalog/index.mako | 3 --- tailbone/views/batch/vendorcatalog.py | 17 +++++++++++------ 4 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 tailbone/static/files/vendor_catalog_template.xlsx create mode 100644 tailbone/templates/batch/vendorcatalog/configure.mako diff --git a/tailbone/static/files/vendor_catalog_template.xlsx b/tailbone/static/files/vendor_catalog_template.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..f68be31d228508d1bd3667c9873b3911f8bab9b3 GIT binary patch literal 7593 zcmeHMWmwev5+tzmTr&+>COcKr5mI~1O!Rx7D>USTe?A7x}`68&vWH? z&p99N=R5mh_t|G>_W!)|d*?Uvjo5uJS#V>5=!Mon!ogOJQq{x}M^;FsV9iA^3-QHT;;Y`BTd^E&D z=C>-~0}JTXEZy8-_!S%*lR=SiPUn~yE65)3FTI^}L!EO6dc>5K5RMWckq_h6_!zyi zCu1pN4}QorsZGXhA)F!qc5FD`)cQj_=xyVUauVd4%BleN_)YEv7pmnj9+i8?i<_Yn zyJ^zrC#yaZgg|YX=nmK?OxEAon1Ae4X2Ty;_&^jcl$5+{Lib}9JQ5a~>uM3#UQ_3Jw2{a;r9@k6w%KYU?>3k(+c_d_KCT-TmTNp&(VPKU17AU-b z1Lb0A>}+nP=IU%^Z{c!>Q{vY?MR;l~q`i72P_5p2iJ_G?iT={3@*0nd$a=bZcn;ev zp)-=EbR`NtK{g4p&!pWwqc87ijE1wFZFwYkK#^6 z^!39|+GEl-$ciJydFt68W8Ts{ECpIam{uxE{yMbTH3;n){~+=Ayg=0nM{cJ0(6!7I)lx z-uI)CxBthMR^}vPk(wpLa|aJ7aWY;G$0mwj?K?mI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C44vS9fIlv_-`($*mb*gx%Zdr_x&Kji kfA_wB%>VrKqqisFFN%?}Ji;v_U|`ViUbokB$WH?N3&9)PivR!s literal 0 HcmV?d00001 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: