commit
						d05a41d4f6
					
				
					 1 changed files with 9 additions and 2 deletions
				
			
		|  | @ -122,12 +122,19 @@ class InvoiceController(ForId, object): | ||||||
| 
 | 
 | ||||||
|         line_items = [] |         line_items = [] | ||||||
| 
 | 
 | ||||||
|  |         def format_product(product): | ||||||
|  |             return "%s - %s" % (product.category.name, product.name) | ||||||
|  | 
 | ||||||
|  |         def format_discount(discount, product): | ||||||
|  |             description = discount.description | ||||||
|  |             return "%s (%s)" % (description, format_product(product)) | ||||||
|  | 
 | ||||||
|         invoice_value = Decimal() |         invoice_value = Decimal() | ||||||
|         for item in product_items: |         for item in product_items: | ||||||
|             product = item.product |             product = item.product | ||||||
|             line_item = commerce.LineItem( |             line_item = commerce.LineItem( | ||||||
|                 invoice=invoice, |                 invoice=invoice, | ||||||
|                 description="%s - %s" % (product.category.name, product.name), |                 description=format_product(product), | ||||||
|                 quantity=item.quantity, |                 quantity=item.quantity, | ||||||
|                 price=product.price, |                 price=product.price, | ||||||
|                 product=product, |                 product=product, | ||||||
|  | @ -137,7 +144,7 @@ class InvoiceController(ForId, object): | ||||||
|         for item in discount_items: |         for item in discount_items: | ||||||
|             line_item = commerce.LineItem( |             line_item = commerce.LineItem( | ||||||
|                 invoice=invoice, |                 invoice=invoice, | ||||||
|                 description=item.discount.description, |                 description=format_discount(item.discount, item.product), | ||||||
|                 quantity=item.quantity, |                 quantity=item.quantity, | ||||||
|                 price=cls.resolve_discount_value(item) * -1, |                 price=cls.resolve_discount_value(item) * -1, | ||||||
|                 product=item.product, |                 product=item.product, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Christopher Neugebauer
						Christopher Neugebauer