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

fix cost unit validation

parent 8db1a387
No related branches found
No related tags found
No related merge requests found
Pipeline #12144 passed
......@@ -607,13 +607,13 @@ class Contract(NameStrMixin, models.Model):
{"cost_amount": "Nemůže být definováno bez jednoty nákladů."}
)
if self.cost_unit == self.CostUnits.OTHER[1] and not self.cost_unit_other:
if self.cost_unit == self.CostUnits.OTHER and not self.cost_unit_other:
raise ValidationError(
{
"cost_unit_other": "Musí být definováno, pokud je vybrána jednotka nákladů 'jiné'."
}
)
elif self.cost_unit != self.CostUnits.OTHER[1] and self.cost_unit_other:
elif self.cost_unit != self.CostUnits.OTHER and self.cost_unit_other:
raise ValidationError(
{
"cost_unit_other": "Nemůže být definováno, pokud není vybrána jednotka nákladů 'jiné'."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment