Make caching products optional, when creating vendor catalog batch
This commit is contained in:
		
							parent
							
								
									6397a93f97
								
							
						
					
					
						commit
						e9edf205d9
					
				
					 1 changed files with 15 additions and 0 deletions
				
			
		|  | @ -83,6 +83,7 @@ class VendorCatalogView(FileBatchMasterView): | ||||||
|         'vendor', |         'vendor', | ||||||
|         'future', |         'future', | ||||||
|         'effective', |         'effective', | ||||||
|  |         'cache_products', | ||||||
|         'params', |         'params', | ||||||
|         'description', |         'description', | ||||||
|         'notes', |         'notes', | ||||||
|  | @ -255,6 +256,15 @@ class VendorCatalogView(FileBatchMasterView): | ||||||
|             f.remove('future', |             f.remove('future', | ||||||
|                      'effective') |                      '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): |     def render_parser_key(self, batch, field): | ||||||
|         key = getattr(batch, field) |         key = getattr(batch, field) | ||||||
|         if not key: |         if not key: | ||||||
|  | @ -314,6 +324,11 @@ class VendorCatalogView(FileBatchMasterView): | ||||||
|             kwargs['effective'] = batch.effective |             kwargs['effective'] = batch.effective | ||||||
|         return kwargs |         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): |     def configure_row_grid(self, g): | ||||||
|         super(VendorCatalogView, self).configure_row_grid(g) |         super(VendorCatalogView, self).configure_row_grid(g) | ||||||
|         batch = self.get_instance() |         batch = self.get_instance() | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar