Merge pull request #378 from flokli/shopticket-backoffice-quantity

Show Quantity of ShopTickets in backoffice
This commit is contained in:
Víðir Valberg Guðmundsson 2019-08-09 10:19:26 +02:00 committed by GitHub
commit 66c2224806
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View file

@ -56,6 +56,13 @@
<strong>Product:</strong>
<td>
{{ ticket.product }}
{% if ticket.ticket_type.single_ticket_per_product and ticket.shortname == "shop" %}
<tr>
<td>
<strong>Quantity:</strong>
<td>
{{ ticket.orp.quantity }}
{% endif %}
<tr>
<td>
<strong>Order:</strong>

View file

@ -40,7 +40,7 @@
<td>
{{ ticket.product.name }}
<td>
{% if ticket.ticket_type.single_ticket_per_product %}{{ ticket.get_orp.quantity }} &times; {% endif %}
{% if ticket.ticket_type.single_ticket_per_product %}{{ ticket.orp.quantity }} &times; {% endif %}
{{ ticket.product.price|currency }}
<td>
{% if ticket.used %}

View file

@ -93,8 +93,7 @@ class BaseTicket(CampRelatedModel, UUIDModel):
formatdict = {"ticket": self}
if self.ticket_type.single_ticket_per_product and self.shortname == "shop":
orp = self.get_orp()
formatdict["quantity"] = orp.quantity
formatdict["quantity"] = self.orp.quantity
return generate_pdf_letter(
filename="{}_ticket_{}.pdf".format(self.shortname, self.pk),
@ -165,5 +164,6 @@ class ShopTicket(BaseTicket):
def shortname(self):
return "shop"
def get_orp(self):
@property
def orp(self):
return OrderProductRelation.objects.get(product=self.product, order=self.order)