Commit 41d5a02d authored by Sli's avatar Sli
Browse files

Fixed account order and detail account view

parent 8d060af4
Pipeline #202 failed with stage
in 2 minutes and 27 seconds
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for i in customer.refillings.order_by('-date').all() %} {% for i in customer.refillings.order_by('-date').filter(
date__year=year, date__month=month) %}
<tr> <tr>
<td>{{ i.date|localtime|date(DATETIME_FORMAT) }} - {{ i.date|localtime|time(DATETIME_FORMAT) }}</td> <td>{{ i.date|localtime|date(DATETIME_FORMAT) }} - {{ i.date|localtime|time(DATETIME_FORMAT) }}</td>
<td>{{ i.counter }}</td> <td>{{ i.counter }}</td>
...@@ -51,7 +52,8 @@ ...@@ -51,7 +52,8 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for i in customer.buyings.order_by('-date').all() %} {% for i in customer.buyings.order_by('-date').all().filter(
date__year=year, date__month=month) %}
<tr> <tr>
<td>{{ i.date|localtime|date(DATETIME_FORMAT) }} - {{ i.date|localtime|time(DATETIME_FORMAT) }}</td> <td>{{ i.date|localtime|date(DATETIME_FORMAT) }} - {{ i.date|localtime|time(DATETIME_FORMAT) }}</td>
<td>{{ i.counter }}</td> <td>{{ i.counter }}</td>
...@@ -79,7 +81,8 @@ ...@@ -79,7 +81,8 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for i in customer.user.invoices.order_by('-date').all() %} {% for i in customer.user.invoices.order_by('-date').all().filter(
date__year=year, date__month=month) %}
<tr> <tr>
<td>{{ i.date|localtime|date(DATETIME_FORMAT) }} - {{ i.date|localtime|time(DATETIME_FORMAT) }}</td> <td>{{ i.date|localtime|date(DATETIME_FORMAT) }} - {{ i.date|localtime|time(DATETIME_FORMAT) }}</td>
<td> <td>
......
...@@ -328,11 +328,11 @@ class UserAccountView(UserAccountBase): ...@@ -328,11 +328,11 @@ class UserAccountView(UserAccountBase):
def expense_by_month(self, obj, calc): def expense_by_month(self, obj, calc):
stats = [] stats = []
for year in obj.datetimes('date', 'year', order='ASC'): for year in obj.datetimes('date', 'year', order='DESC'):
stats.append([]) stats.append([])
i = 0 i = 0
for month in obj.filter(date__year=year.year).datetimes( for month in obj.filter(date__year=year.year).datetimes(
'date', 'month', order='ASC'): 'date', 'month', order='DESC'):
q = obj.filter( q = obj.filter(
date__year=month.year, date__year=month.year,
date__month=month.month date__month=month.month
...@@ -391,6 +391,8 @@ class UserAccountDetailView(UserAccountBase, YearMixin, MonthMixin): ...@@ -391,6 +391,8 @@ class UserAccountDetailView(UserAccountBase, YearMixin, MonthMixin):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs = super(UserAccountDetailView, self).get_context_data(**kwargs) kwargs = super(UserAccountDetailView, self).get_context_data(**kwargs)
kwargs['profile'] = self.object kwargs['profile'] = self.object
kwargs['year'] = self.get_year()
kwargs['month'] = self.get_month()
try: try:
kwargs['customer'] = self.object.customer kwargs['customer'] = self.object.customer
except: except:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment