diff --git a/eboutic/models.py b/eboutic/models.py
index ab7485de..4d43ce26 100644
--- a/eboutic/models.py
+++ b/eboutic/models.py
@@ -24,6 +24,7 @@
from django.db import models, DataError
from django.utils.translation import ugettext_lazy as _
+from django.utils.functional import cached_property
from django.conf import settings
from accounting.models import CurrencyField
@@ -68,6 +69,12 @@ class Basket(models.Model):
if item.quantity <= 0:
item.delete()
+ @cached_property
+ def contains_refilling_item(self):
+ return self.items.filter(
+ type_id=settings.SITH_COUNTER_PRODUCTTYPE_REFILLING
+ ).exists()
+
def get_total(self):
total = 0
for i in self.items.all():
diff --git a/eboutic/templates/eboutic/eboutic_main.jinja b/eboutic/templates/eboutic/eboutic_main.jinja
index d416161e..38a212b1 100644
--- a/eboutic/templates/eboutic/eboutic_main.jinja
+++ b/eboutic/templates/eboutic/eboutic_main.jinja
@@ -35,10 +35,13 @@
{% trans %}Basket amount: {% endtrans %}{{ "%0.2f"|format(basket.get_total()) }} €
{% if customer_amount != None %}
-
- {% trans %}Current account amount: {% endtrans %}{{ "%0.2f"|format(customer_amount) }} €
-
- {% trans %}Remaining account amount: {% endtrans %}{{ "%0.2f"|format(customer_amount - basket.get_total()) }} €
+
+ {% trans %}Current account amount: {% endtrans %}{{ "%0.2f"|format(customer_amount) }} €
+
+ {% if not basket.contains_refilling_item %}
+
+ {% trans %}Remaining account amount: {% endtrans %}{{ "%0.2f"|format(customer_amount - basket.get_total()) }} €
+ {% endif %}
{% endif %}
{% trans %}AE account payment disabled because your basket contains refilling items.{% endtrans %}
{% else %}