diff options
Diffstat (limited to 'archaeological_operations/forms.py')
-rw-r--r-- | archaeological_operations/forms.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index a5c9d5b1b..72d2eaf35 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -1497,9 +1497,9 @@ class AdministrativeActOpeSelect(DocumentItemSelect): def __init__(self, *args, **kwargs): super(AdministrativeActOpeSelect, self).__init__(*args, **kwargs) self.fields['act_type'].choices = models.ActType.get_types( - dct={'intented_to': 'O'}) + dct={"intented_to_operation": True}) self.fields['act_type'].help_text = models.ActType.get_help( - dct={'intented_to': 'O'}) + dct={"intented_to_operation": True}) if settings.ISHTAR_DPTS: k = 'operation__towns__numero_insee__startswith' self.fields[k].choices = [ @@ -1546,7 +1546,7 @@ class AdministrativeActForm(CustomForm, ManageOldType): TYPES = [ FieldType('act_type', models.ActType, - extra_args={"dct": {'intented_to': 'O'}}), + extra_args={"dct": {"intented_to_operation": True}}), ] @@ -1617,10 +1617,19 @@ class DocumentGenerationAdminActForm(IshtarForm): if 'obj' in kwargs: self.obj = kwargs.pop('obj') super(DocumentGenerationAdminActForm, self).__init__(*args, **kwargs) + filtr = { + 'associated_model__klass': 'archaeological_operations.models.AdministrativeAct', + } + if self.document_type == "O": + filtr["acttypes__intented_to_operation"] = True + elif self.document_type == "F": + filtr["acttypes__intented_to_file"] = True + elif self.document_type == "T": + filtr["acttypes__intented_to_treatment"] = True + elif self.document_type == "TF": + filtr["acttypes__intented_to_treatment_request"] = True self.fields['document_template'].choices = DocumentTemplate.get_tuples( - dct={'associated_model__klass': - 'archaeological_operations.models.AdministrativeAct', - 'acttypes__intented_to': self.document_type}) + dct=filtr) def clean(self): if not self.obj: |