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

run hooks

parent 787e8688
No related branches found
No related tags found
No related merge requests found
Pipeline #13524 passed
...@@ -34,34 +34,54 @@ class ContractAdminForm(forms.ModelForm): ...@@ -34,34 +34,54 @@ class ContractAdminForm(forms.ModelForm):
if self.instance.id is None: if self.instance.id is None:
if choice_key in ( if choice_key in (
Contract.StatusTypes.WORK_IN_PROGRESS, Contract.StatusTypes.WORK_IN_PROGRESS,
Contract.StatusTypes.TO_BE_APPROVED Contract.StatusTypes.TO_BE_APPROVED,
): ):
allowed_choices.append((choice_key, choice_label,)) allowed_choices.append(
(
choice_key,
choice_label,
)
)
continue continue
if self.instance.status == choice_key: if self.instance.status == choice_key:
allowed_choices.append((choice_key, choice_label,)) allowed_choices.append(
(
choice_key,
choice_label,
)
)
continue continue
if self.instance.status in ( if self.instance.status in (
Contract.StatusTypes.WORK_IN_PROGRESS, Contract.StatusTypes.WORK_IN_PROGRESS,
Contract.StatusTypes.TO_BE_APPROVED Contract.StatusTypes.TO_BE_APPROVED,
): ):
if self.current_user.has_perm("contract.approve"): if self.current_user.has_perm("contract.approve"):
if choice_key in ( if choice_key in (
Contract.StatusTypes.APPROVED, Contract.StatusTypes.APPROVED,
Contract.StatusTypes.REJECTED Contract.StatusTypes.REJECTED,
): ):
allowed_choices.append((choice_key, choice_label,)) allowed_choices.append(
(
choice_key,
choice_label,
)
)
continue continue
if self.instance.status == Contract.StatusTypes.REJECTED: if self.instance.status == Contract.StatusTypes.REJECTED:
if choice_key in ( if choice_key in (
Contract.StatusTypes.WORK_IN_PROGRESS, Contract.StatusTypes.WORK_IN_PROGRESS,
Contract.StatusTypes.TO_BE_APPROVED Contract.StatusTypes.TO_BE_APPROVED,
): ):
allowed_choices.append((choice_key, choice_label,)) allowed_choices.append(
(
choice_key,
choice_label,
)
)
continue continue
self.fields["status"].widget = forms.Select(choices=allowed_choices) self.fields["status"].widget = forms.Select(choices=allowed_choices)
...@@ -75,11 +95,7 @@ class ContractAdminForm(forms.ModelForm): ...@@ -75,11 +95,7 @@ class ContractAdminForm(forms.ModelForm):
== self.instance.StatusTypes.REJECTED == self.instance.StatusTypes.REJECTED
): ):
raise ValidationError( raise ValidationError(
{ {"status": ("Smlouvu nelze upravovat, zatímco je zamítnutá.")}
"status": (
"Smlouvu nelze upravovat, zatímco je zamítnutá."
)
}
) )
if ( if (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment