#18 EcoAccount funding

* adds constraint for setting the deductable_surface too low -> existing deductions would not be valid anymore
* adds/updates translations
This commit is contained in:
mipel
2021-09-20 09:03:03 +02:00
parent fbcb2d9afd
commit df4052ac00
3 changed files with 66 additions and 49 deletions

View File

@@ -298,6 +298,14 @@ class EcoAccount(AbstractCompensation):
if self.deductable_surface > after_state_sum:
raise ValidationError(_("Deductable surface can not be larger than existing surfaces in after states"))
# Deductable surface can not be lower than amount of already deducted surfaces
# User needs to contact deducting user in case of further problems
deducted_sum = self.get_deductions_surface()
if self.deductable_surface < deducted_sum:
raise ValidationError(
_("Deductable surface can not be smaller than the sum of already existing deductions. Please contact the responsible users for the deductions!")
)
def save(self, *args, **kwargs):
if self.identifier is None or len(self.identifier) == 0:
# Create new identifier