From b42e27a973e34eb143a2510b7e60d3abafdfb4c6 Mon Sep 17 00:00:00 2001 From: Brad Campbell Date: Sun, 22 May 2016 17:51:11 -0400 Subject: [PATCH] show deleted transactions in cashbox empty summary --- chezbetty/models/model.py | 3 ++- chezbetty/models/transaction.py | 2 +- chezbetty/templates/admin/event.jinja2 | 12 +++--------- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/chezbetty/models/model.py b/chezbetty/models/model.py index d75cc64..9618fd2 100644 --- a/chezbetty/models/model.py +++ b/chezbetty/models/model.py @@ -15,7 +15,8 @@ ForeignKey, Boolean, LargeBinary, - desc + desc, + asc ) from sqlalchemy.ext.declarative import declarative_base diff --git a/chezbetty/models/transaction.py b/chezbetty/models/transaction.py index 0b88ffc..e5972d7 100644 --- a/chezbetty/models/transaction.py +++ b/chezbetty/models/transaction.py @@ -473,7 +473,7 @@ def __relevant_cash_deposits(self): # Now get all cash deposits between that cash box empty and this one q = object_session(self).query(event.Deposit)\ .filter(event.Event.timestamp < self.timestamp)\ - .filter(event.Event.deleted==False) + .order_by(asc(event.Event.timestamp)) if previous_cb_empty: q = q.filter(event.Event.timestamp >= previous_cb_empty.timestamp) diff --git a/chezbetty/templates/admin/event.jinja2 b/chezbetty/templates/admin/event.jinja2 index a5fc6db..874e157 100644 --- a/chezbetty/templates/admin/event.jinja2 +++ b/chezbetty/templates/admin/event.jinja2 @@ -152,8 +152,8 @@ Timestamp Type - From Account: To Account: + Deleted: Amount @@ -162,23 +162,17 @@ {% for t in e.transactions %} {% if t.type == 'cashdeposit' %} - + {{ button.event(e.id) }} {{ e.timestamp|pretty_date|safe }} {{ t.type }} - - {{ t.fr_account_virt|make_link|safe if t.fr_account_virt else "n/a" }} - {# Add account balance next to name for easy lookup. #} - {% if t.fr_account_virt.balance is defined and t.fr_account_virt.type != 'virtual' %} - ({{ t.fr_account_virt.balance|format_currency|safe }}) - {% endif %} - {{ t.to_account_virt|make_link|safe if t.to_account_virt else "n/a" }} {% if t.to_account_virt.balance is defined and t.to_account_virt.type != 'virtual' %} ({{ t.to_account_virt.balance|format_currency|safe }}) {% endif %} + {% if e.deleted==True %}DELETED{% endif %} {{ t.amount|format_currency|safe }} {% endif %}