|
@@ -177,6 +177,12 @@ class Cost(AbstractResource):
|
|
verbose_name = 'Coût mensuel'
|
|
verbose_name = 'Coût mensuel'
|
|
|
|
|
|
|
|
|
|
|
|
+class GoodQuerySet(models.QuerySet):
|
|
|
|
+ def monthly_provision_total(self):
|
|
|
|
+ # FIXME: could be optimized easily
|
|
|
|
+ return sum([i.monthly_provision() for i in self.all()])
|
|
|
|
+
|
|
|
|
+
|
|
class Good(AbstractResource):
|
|
class Good(AbstractResource):
|
|
""" A good, which replacement is provisioned
|
|
""" A good, which replacement is provisioned
|
|
"""
|
|
"""
|
|
@@ -185,6 +191,8 @@ class Good(AbstractResource):
|
|
"Durée d'amortissement",
|
|
"Durée d'amortissement",
|
|
choices=settings.PROVISIONING_DURATIONS)
|
|
choices=settings.PROVISIONING_DURATIONS)
|
|
|
|
|
|
|
|
+ objects = GoodQuerySet.as_manager()
|
|
|
|
+
|
|
def get_use_class(self):
|
|
def get_use_class(self):
|
|
return GoodUse
|
|
return GoodUse
|
|
|
|
|