Add configurable template file for vendor catalog batch
This commit is contained in:
parent
ad110c2ce2
commit
f89dc88c0e
4 changed files with 20 additions and 9 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue