diff --git a/core/templates/core/user_account_detail.jinja b/core/templates/core/user_account_detail.jinja
index ccf41cfb..4c6275c8 100644
--- a/core/templates/core/user_account_detail.jinja
+++ b/core/templates/core/user_account_detail.jinja
@@ -30,7 +30,11 @@
- {{ purchase.date|localtime|time(DATETIME_FORMAT) }}
{{ purchase.counter }} |
- {{ purchase.seller.get_display_name() }} |
+ {% if not purchase.seller %}
+ {% trans %}Deleted user{% endtrans %} |
+ {% else %}
+ {{ purchase.seller.get_display_name() }} |
+ {% endif %}
{{ purchase.label }} |
{{ purchase.quantity }} |
{{ purchase.quantity * purchase.unit_price }} € |
diff --git a/core/tests/test_user.py b/core/tests/test_user.py
index 5d4cb734..8be9bf5f 100644
--- a/core/tests/test_user.py
+++ b/core/tests/test_user.py
@@ -20,7 +20,8 @@ from core.baker_recipes import (
)
from core.models import Group, User
from core.views import UserTabsMixin
-from counter.models import Counter, Refilling, Selling
+from counter.baker_recipes import sale_recipe
+from counter.models import Counter, Customer, Refilling, Selling
from eboutic.models import Invoice, InvoiceItem
@@ -129,6 +130,31 @@ def test_user_account_not_found(client: Client):
assert res.status_code == 404
+@pytest.mark.django_db
+def test_is_deleted_barman_shown_as_deleted(client: Client):
+ customer = baker.make(Customer)
+ date = now()
+ sale_recipe.make(
+ seller=iter([None, baker.make(User)]),
+ customer=customer,
+ date=date,
+ _quantity=2,
+ _bulk_create=True,
+ )
+ client.force_login(customer.user)
+ res = client.get(
+ reverse(
+ "core:user_account_detail",
+ kwargs={
+ "user_id": customer.user.id,
+ "year": date.year,
+ "month": date.month,
+ },
+ )
+ )
+ assert res.status_code == 200
+
+
class TestFilterInactive(TestCase):
@classmethod
def setUpTestData(cls):
diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po
index 95a2dad7..0c9cd5e5 100644
--- a/locale/fr/LC_MESSAGES/django.po
+++ b/locale/fr/LC_MESSAGES/django.po
@@ -2344,6 +2344,10 @@ msgstr "Etickets"
msgid "User has no account"
msgstr "L'utilisateur n'a pas de compte"
+#: core/templates/core/user_account_detail.jinja
+msgid "Deleted user"
+msgstr "Utilisateur supprimé"
+
#: core/templates/core/user_account_detail.jinja
#: counter/templates/counter/last_ops.jinja
#: counter/templates/counter/refilling_list.jinja
@@ -5514,4 +5518,4 @@ msgstr "Vous ne pouvez plus écrire de commentaires, la date est passée."
#: trombi/views.py
#, python-format
msgid "Maximum characters: %(max_length)s"
-msgstr "Nombre de caractères max: %(max_length)s"
+msgstr "Nombre de caractères max: %(max_length)s"
\ No newline at end of file