mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-11 04:19:25 +00:00
eboutic: don't display future account balance if contains refilling item
This commit is contained in:
@ -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():
|
||||
|
Reference in New Issue
Block a user