Versionise API and cleanups

This commit is contained in:
Nico Schottelius 2020-05-02 20:31:36 +02:00
commit 927fb20671
5 changed files with 32 additions and 34 deletions

View file

@ -825,7 +825,11 @@ class Order(models.Model):
# Trigger initial bill generation at order creation.
def save(self, *args, **kwargs):
super(Order, self).save(*args, **kwargs)
if self.ending_date and self.ending_date < self.starting_date:
raise ValidationError("End date cannot be before starting date")
super().save(*args, **kwargs)
Bill.generate_for(self.starting_date.year, self.starting_date.month, self.owner)
@property