diff --git a/ihatemoney/history.py b/ihatemoney/history.py
index c324c4f7..4fed53ea 100644
--- a/ihatemoney/history.py
+++ b/ihatemoney/history.py
@@ -83,10 +83,26 @@ def get_history(project, human_readable_names=True):
"time": version.transaction.issued_at,
"operation_type": version.operation_type,
"object_type": object_type,
+ "bill_details": None,
"object_desc": object_str,
"ip": version.transaction.remote_addr,
}
+ if object_type == "Bill":
+ if version.operation_type == Operation.INSERT or not version.previous:
+ detailed_version = version
+ else:
+ detailed_version = version.previous
+ details = {
+ "date": detailed_version.date,
+ "payer": describe_version(detailed_version.payer),
+ "amount": detailed_version.amount,
+ "owers": [describe_version(o) for o in detailed_version.owers],
+ "external_link": detailed_version.external_link,
+ "original_currency": detailed_version.original_currency,
+ }
+ common_properties["bill_details"] = details
+
if version.operation_type == Operation.UPDATE:
# Only iterate the changeset if the previous version
# Was logged
diff --git a/ihatemoney/templates/history.html b/ihatemoney/templates/history.html
index 262e04f0..f75b2de1 100644
--- a/ihatemoney/templates/history.html
+++ b/ihatemoney/templates/history.html
@@ -91,6 +91,21 @@
{% endif %}
{% endmacro %}
+{% macro bill_details(details, before=False) %}
+ {% set owers_list_str=details.owers|localize_list|safe %}
+ {% if before %} {{ _("Details of the bill (before the change)") }} {% else %} {{ _("Details of the bill") }} {% endif %}
+ {{ _("Date:") }} {{ details.date|em_surround }}.
+ {{ _("Payer:") }} {{ details.payer|em_surround }}.
+ {{ _("Amount:") }} {{ details.amount|currency(details.original_currency)|em_surround }}.
+ {{ _("Owers:") }} {{ owers_list_str }}.
+ {% if details.external_link %}
+ {{ _("External link:") }}
+ {{ details.external_link }}
+ {% endif %}
+