Skip to content

Commit

Permalink
Include category name in CSV export
Browse files Browse the repository at this point in the history
  • Loading branch information
haavardlian committed Oct 11, 2023
1 parent cf8600e commit 102355b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions p0sx/pos/views/littleadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def sale_overview_csv(request):
)

writer = csv.writer(response)
writer.writerow(["Name", "First sold", "Last sold", "Prepaid", "Credit", "Sold"])
writer.writerow(["Category", "Name", "First sold", "Last sold", "Prepaid", "Credit", "Sold"])
for item in items:
per_payment_method = order_lines.filter(item_id=item['id'])
first_sold = per_payment_method.aggregate(Min('first_sold'))['first_sold__min']
Expand All @@ -163,7 +163,7 @@ def sale_overview_csv(request):
except IndexError:
prepaid = {'sold': 0, 'total': 0, 'first_sold': None, 'last_sold': None}

writer.writerow([item['name'], first_sold, last_sold, prepaid['total'], credit['total'], prepaid['sold'] + credit['sold']])
writer.writerow([item['category__name'], item['name'], first_sold, last_sold, prepaid['total'], credit['total'], prepaid['sold'] + credit['sold']])

return response

Expand Down

0 comments on commit 102355b

Please sign in to comment.