Make caching products optional, when creating vendor catalog batch

This commit is contained in:
Lance Edgar 2022-07-19 15:50:57 -05:00
parent 6397a93f97
commit e9edf205d9

View file

@ -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()