diff --git a/jdav_web/members/models.py b/jdav_web/members/models.py index 26cc7af..a5377e3 100644 --- a/jdav_web/members/models.py +++ b/jdav_web/members/models.py @@ -1431,7 +1431,7 @@ class Freizeit(CommonModel): def potential_ljp_contributions(self): """The maximal amount can be reduced if the actual costs are lower than the maximal amount This calculation if intended for the LJP application, not for the payout.""" - if not self.statement: + if not hasattr(self, 'statement'): return cvt_to_decimal(0) return cvt_to_decimal(min(self.maximal_ljp_contributions, 0.9 * float(self.statement.total_bills_theoretic) + float(self.statement.total_staff))) @@ -1440,13 +1440,13 @@ class Freizeit(CommonModel): def payable_ljp_contributions(self): """the payable contributions can differ from potential contributions if a tax is deducted for risk reduction. the actual payout depends on more factors, e.g. the actual costs that had to be paid by the trip organisers.""" - if self.statement.ljp_to: + if hasattr(self, 'statement') and self.statement.ljp_to: return self.statement.paid_ljp_contributions return cvt_to_decimal(self.potential_ljp_contributions * cvt_to_decimal(1 - settings.LJP_TAX)) @property def total_relative_costs(self): - if not self.statement: + if not hasattr(self, 'statement'): return 0 total_costs = self.statement.total_bills_theoretic total_contributions = self.statement.total_subsidies + self.payable_ljp_contributions