Add support for Product.not_for_sale flag.
				
					
				
			This involved a couple of ancillary changes: * The price field renderer will not display a price for products marked not for sale. * The "grid" class now allows specifying a custom callable to provide additional CSS class for table rows. * The products grid uses this to add a "not-for-sale" class to table rows for products which are marked thusly.
This commit is contained in:
		
							parent
							
								
									98f6a7377b
								
							
						
					
					
						commit
						dfb5e83c7e
					
				
					 3 changed files with 39 additions and 21 deletions
				
			
		|  | @ -190,7 +190,9 @@ class ProductsGrid(SearchableAlchemyGridView): | |||
|         return q | ||||
| 
 | ||||
|     def grid(self): | ||||
|         g = self.make_grid() | ||||
|         def extra_row_class(row, i): | ||||
|             return 'not-for-sale' if row.not_for_sale else None | ||||
|         g = self.make_grid(extra_row_class=extra_row_class) | ||||
|         g.upc.set(renderer=GPCFieldRenderer) | ||||
|         g.regular_price.set(renderer=PriceFieldRenderer) | ||||
|         g.current_price.set(renderer=PriceFieldRenderer) | ||||
|  | @ -264,6 +266,7 @@ class ProductCrud(CrudView): | |||
|                 fs.report_code, | ||||
|                 fs.regular_price, | ||||
|                 fs.current_price, | ||||
|                 fs.not_for_sale, | ||||
|                 ]) | ||||
|         if not self.readonly: | ||||
|             del fs.regular_price | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar