Eco account unit tests
* adds eco account unit tests * adds validity check to eco account form to check on existing deductions and potential conflict with reduced deductable surface * improves geojson handling on SimpleGeomForm * adds/updates translation
This commit is contained in:
@@ -59,20 +59,6 @@ class EcoAccount(AbstractCompensation, ShareableObjectMixin, RecordableObjectMix
|
||||
def __str__(self):
|
||||
return f"{self.identifier} ({self.title})"
|
||||
|
||||
def clean(self):
|
||||
# Deductable surface can not be larger than added states after surface
|
||||
after_state_sum = self.get_surface_after_states()
|
||||
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 if none was given
|
||||
|
||||
Reference in New Issue
Block a user