Skip to content
Snippets Groups Projects
Commit ecb6c2d9 authored by Tomáš Valenta's avatar Tomáš Valenta
Browse files

validate end date

parent 8e9a68ce
No related branches found
No related tags found
No related merge requests found
Pipeline #12254 passed
......@@ -657,6 +657,17 @@ class Contract(NameStrMixin, models.Model):
}
)
if (
self.valid_start_date
and self.valid_end_date
and self.valid_start_date > self.valid_end_date
):
raise ValidationError(
{
"valid_end_date": "Konec platnosti nemůže být definován dříve, než začátek."
}
)
if self.cost_amount is None and self.cost_unit: # 0 is falsy, but a value
raise ValidationError(
{"cost_unit": "Nemůže být definováno, pokud nejsou zadány náklady."}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment