From de3734bf2000ba0c2db170342cb055f0a960b48b Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 3 Apr 2019 20:29:33 +0200 Subject: [PATCH] Add total_in_chf utility method --- hosting/models.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hosting/models.py b/hosting/models.py index fb2a805b..b735bb8f 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -325,6 +325,15 @@ class MonthlyHostingBill(AssignPermissionsMixin, models.Model): instance.assign_permissions(instance.customer.user) return instance + def total_in_chf(self): + """ + Returns amount in chf. The total amount in this model is in cents. + Hence we multiply it by 0.01 to obtain the result + + :return: + """ + return self.total * 0.01 + class VMDetail(models.Model): user = models.ForeignKey(CustomUser)