* adds creation of new compensation directly from intervention detail view
* adds comment rendering on compensation detail view (WIP)
* adds shared_access_required decorator
* adds/updates translations
This commit is contained in:
mipel
2021-10-04 13:23:14 +02:00
parent b7ef6ff006
commit a50deaaf18
12 changed files with 104 additions and 26 deletions

View File

@@ -92,10 +92,21 @@ class NewCompensationForm(BaseForm):
)
def __init__(self, *args, **kwargs):
intervention_id = kwargs.pop("intervention_id", None)
super().__init__(*args, **kwargs)
self.form_title = _("New compensation")
self.action_url = reverse("compensation:new")
self.cancel_redirect = reverse("compensation:index")
# If the compensation shall directly be initialized from an intervention, we need to fill in the intervention id
# and disable the form field.
# Furthermore the action_url needs to be set accordingly.
if intervention_id is not None:
self.initialize_form_field("intervention", intervention_id)
self.disable_form_field("intervention")
self.action_url = reverse("compensation:new", args=(intervention_id,))
self.cancel_redirect = reverse("intervention:open", args=(intervention_id,))
else:
self.action_url = reverse("compensation:new")
self.cancel_redirect = reverse("compensation:index")
tmp = Compensation()
identifier = tmp._generate_new_identifier()