mirror of
https://github.com/ae-utbm/sith.git
synced 2025-10-09 16:24:39 +00:00
forbid past dates for product actions
This commit is contained in:
@@ -1385,3 +1385,13 @@ class ScheduledProductAction(PeriodicTask):
|
||||
def full_clean(self, *args, **kwargs):
|
||||
self.one_off = True # A product action should occur one time only
|
||||
return super().full_clean(*args, **kwargs)
|
||||
|
||||
def clean_clocked(self):
|
||||
if not self.clocked:
|
||||
raise ValidationError(_("Product actions must declare a clocked schedule."))
|
||||
|
||||
def validate_unique(self, exclude):
|
||||
# The checks done in PeriodicTask.validate_unique aren't
|
||||
# adapted in the case of scheduled product action,
|
||||
# so we skip it and execute directly Model.validate_unique
|
||||
return super(PeriodicTask, self).validate_unique(exclude=exclude)
|
||||
|
Reference in New Issue
Block a user