Discount line items now describe the product that the discount applies to.

This commit is contained in:
Christopher Neugebauer 2016-08-24 11:46:15 +10:00
parent 1b40472835
commit 0b7396c40f

View file

@ -122,12 +122,19 @@ class InvoiceController(ForId, object):
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()
for item in product_items:
product = item.product
line_item = commerce.LineItem(
invoice=invoice,
description="%s - %s" % (product.category.name, product.name),
description=format_product(product),
quantity=item.quantity,
price=product.price,
product=product,
@ -137,7 +144,7 @@ class InvoiceController(ForId, object):
for item in discount_items:
line_item = commerce.LineItem(
invoice=invoice,
description=item.discount.description,
description=format_discount(item.discount, item.product),
quantity=item.quantity,
price=cls.resolve_discount_value(item) * -1,
product=item.product,