From e9edf205d95b260ed51b16996055097e58c25fcc Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 19 Jul 2022 15:50:57 -0500 Subject: [PATCH] Make caching products optional, when creating vendor catalog batch --- tailbone/views/batch/vendorcatalog.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tailbone/views/batch/vendorcatalog.py b/tailbone/views/batch/vendorcatalog.py index f1dd9754..e630c57e 100644 --- a/tailbone/views/batch/vendorcatalog.py +++ b/tailbone/views/batch/vendorcatalog.py @@ -83,6 +83,7 @@ class VendorCatalogView(FileBatchMasterView): 'vendor', 'future', 'effective', + 'cache_products', 'params', 'description', 'notes', @@ -255,6 +256,15 @@ class VendorCatalogView(FileBatchMasterView): f.remove('future', 'effective') + if self.creating: + f.set_node('cache_products', colander.Boolean()) + f.set_type('cache_products', 'boolean') + f.set_helptext('cache_products', + "If set, will pre-cache all products for quicker " + "lookups when loading the catalog.") + else: + f.remove('cache_products') + def render_parser_key(self, batch, field): key = getattr(batch, field) if not key: @@ -314,6 +324,11 @@ class VendorCatalogView(FileBatchMasterView): kwargs['effective'] = batch.effective return kwargs + def save_create_form(self, form): + batch = super(VendorCatalogView, self).save_create_form(form) + batch.set_param('cache_products', form.validated['cache_products']) + return batch + def configure_row_grid(self, g): super(VendorCatalogView, self).configure_row_grid(g) batch = self.get_instance()