add some validationErrors on OperationForm

This commit is contained in:
2017-06-09 16:04:24 +02:00
parent 1bcde80a28
commit 0e171fbc8f
2 changed files with 19 additions and 10 deletions

View File

@ -282,7 +282,9 @@ class Operation(models.Model):
def clean(self):
super(Operation, self).clean()
if self.date < self.journal.start_date:
if self.date is None:
raise ValidationError(_("The date must be set."))
elif self.date < self.journal.start_date:
raise ValidationError(_("""The date can not be before the start date of the journal, which is
%(start_date)s.""") % {'start_date': defaultfilters.date(self.journal.start_date, settings.DATE_FORMAT)})
if self.target_type != "OTHER" and self.get_target() is None: