summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-03-17 19:40:24 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-03-17 19:46:08 +0100
commit0fb6a394915591ac828c364bffe40e01419e4c5e (patch)
tree50be84a8e66f5c59fe6262b7626f70e39635e0df
parent24ce5d46977ed8b8b61acaf3cf3fbbf9e51c6fb0 (diff)
downloadIshtar-0fb6a394915591ac828c364bffe40e01419e4c5e.tar.bz2
Ishtar-0fb6a394915591ac828c364bffe40e01419e4c5e.zip
✨ administrative act: intented to is now many (refs #6210)
-rw-r--r--archaeological_files/forms.py10
-rw-r--r--archaeological_files/tests.py4
-rw-r--r--archaeological_finds/forms_treatments.py12
-rw-r--r--archaeological_operations/admin.py11
-rw-r--r--archaeological_operations/fixtures/initial_data-fr.json102
-rw-r--r--archaeological_operations/forms.py21
-rw-r--r--archaeological_operations/migrations/0122_admin_act_many_intented_to.py48
-rw-r--r--archaeological_operations/models.py14
-rw-r--r--archaeological_operations/tests.py4
9 files changed, 150 insertions, 76 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py
index 6b150a9d5..a61b500df 100644
--- a/archaeological_files/forms.py
+++ b/archaeological_files/forms.py
@@ -1117,10 +1117,10 @@ class AdministrativeActFileModifySelect(TableSelect):
super(AdministrativeActFileModifySelect, self).__init__(*args, **kwargs)
if "act_type" in self.fields:
self.fields["act_type"].choices = ActType.get_types(
- dct={"intented_to": "F"}
+ dct={"intented_to_file": True}
)
self.fields["act_type"].help_text = ActType.get_help(
- dct={"intented_to": "F"}
+ dct={"intented_to_file": True}
)
k = "operation__towns__numero_insee__startswith"
if settings.ISHTAR_DPTS and k in self.fields:
@@ -1215,10 +1215,10 @@ class AdministrativeActFileSelect(TableSelect):
super(AdministrativeActFileSelect, self).__init__(*args, **kwargs)
if "act_type" in self.fields:
self.fields["act_type"].choices = ActType.get_types(
- dct={"intented_to": "F"}
+ dct={"intented_to_file": True}
)
self.fields["act_type"].help_text = ActType.get_help(
- dct={"intented_to": "F"}
+ dct={"intented_to_file": True}
)
k = "associated_file__towns__numero_insee__startswith"
if k in self.fields and settings.ISHTAR_DPTS:
@@ -1261,7 +1261,7 @@ class AdministrativeActFileForm(AdministrativeActForm):
act_type = forms.ChoiceField(label=_("Act type"), choices=[])
TYPES = [
- FieldType("act_type", ActType, extra_args={"dct": {"intented_to": "F"}}),
+ FieldType("act_type", ActType, extra_args={"dct": {"intented_to_file": True}}),
]
diff --git a/archaeological_files/tests.py b/archaeological_files/tests.py
index 271686de3..8e99f59b8 100644
--- a/archaeological_files/tests.py
+++ b/archaeological_files/tests.py
@@ -52,7 +52,7 @@ from archaeological_operations.tests import OperationInitTest, FileInit
"""
def create_administrativact(user, fle):
act_type, created = ActType.objects.get_or_create(
- txt_idx="act_type_F", intented_to="F"
+ txt_idx="act_type_F", intented_to_file=True
)
dct = {
"history_modifier": user,
@@ -1110,7 +1110,7 @@ class FileAdminActWizardCreationTest(WizardTest, OperationInitTest, TestCase):
)
data = self.form_datas[0].form_datas
data["selec"]["pk"] = self.file.pk
- act = ActType.objects.filter(intented_to="F").all()[0].pk
+ act = ActType.objects.filter(intented_to_file=True).all()[0].pk
data["administrativeact"]["act_type"] = act
self.number = AdministrativeAct.objects.count()
super().pre_wizard()
diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py
index 2c10028d4..3131f4e1d 100644
--- a/archaeological_finds/forms_treatments.py
+++ b/archaeological_finds/forms_treatments.py
@@ -647,9 +647,9 @@ class AdministrativeActTreatmentSelect(TableSelect):
def __init__(self, *args, **kwargs):
super(AdministrativeActTreatmentSelect, self).__init__(*args, **kwargs)
self.fields['act_type'].choices = ActType.get_types(
- dct={'intented_to': 'T'})
+ dct={"intented_to_treatment": True})
self.fields['act_type'].help_text = ActType.get_help(
- dct={'intented_to': 'T'})
+ dct={"intented_to_treatment": True})
self.fields['treatment__treatment_types'].choices = \
models.TreatmentType.get_types()
self.fields['treatment__treatment_types'].help_text = \
@@ -673,7 +673,7 @@ class AdministrativeActTreatmentForm(AdministrativeActForm):
TYPES = [
FieldType('act_type', ActType,
- extra_args={"dct": {'intented_to': 'T'}}),
+ extra_args={"dct": {"intented_to_treatment": True}}),
]
@@ -909,9 +909,9 @@ class AdministrativeActTreatmentFileSelect(TableSelect):
super(AdministrativeActTreatmentFileSelect, self).__init__(*args,
**kwargs)
self.fields['act_type'].choices = ActType.get_types(
- dct={'intented_to': 'TF'})
+ dct={"intented_to_treatment_request": True})
self.fields['act_type'].help_text = ActType.get_help(
- dct={'intented_to': 'TF'})
+ dct={"intented_to_treatment_request": True})
self.fields['treatment_file__type'].choices = \
models.TreatmentFileType.get_types()
self.fields['treatment_file__type'].help_text = \
@@ -935,7 +935,7 @@ class AdministrativeActTreatmentFileForm(AdministrativeActForm):
TYPES = [
FieldType('act_type', ActType,
- extra_args={"dct": {'intented_to': 'TF'}}),
+ extra_args={"dct": {"intented_to_treatment_request": True}}),
]
diff --git a/archaeological_operations/admin.py b/archaeological_operations/admin.py
index 0df6ea7d4..53a290fe3 100644
--- a/archaeological_operations/admin.py
+++ b/archaeological_operations/admin.py
@@ -160,8 +160,15 @@ admin_site.register(models.RecordQualityType, RecordQualityTypeAdmin)
class ActTypeAdmin(GeneralTypeAdmin):
- list_filter = ('intented_to',)
- list_display = ['label', 'txt_idx', 'available', 'intented_to']
+ list_filter = (
+ 'intented_to_file', 'intented_to_operation',
+ 'intented_to_treatment', 'intented_to_treatment_request'
+ )
+ list_display = [
+ 'label', 'txt_idx', 'available', 'intented_to_file', 'intented_to_operation',
+ 'intented_to_treatment', 'intented_to_treatment_request',
+ ]
+ exclude = ["intented_to"]
admin_site.register(models.ActType, ActTypeAdmin)
diff --git a/archaeological_operations/fixtures/initial_data-fr.json b/archaeological_operations/fixtures/initial_data-fr.json
index e3a55c668..26148b5ca 100644
--- a/archaeological_operations/fixtures/initial_data-fr.json
+++ b/archaeological_operations/fixtures/initial_data-fr.json
@@ -6,7 +6,7 @@
"txt_idx": "diagnostic_order",
"comment": "Un arr\u00eat\u00e9 prescrivant la r\u00e9alisation d'un diagnostic sur une surface donn\u00e9e, SANS pr\u00e9cision du responsable scientifique, SANS pr\u00e9cision de l'op\u00e9rateur",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "A_DIAG",
"indexed": true,
"associated_template": []
@@ -19,7 +19,7 @@
"txt_idx": "excavation_order",
"comment": "Un arr\u00eat\u00e9 prescrivant la r\u00e9alisation d'une fouille pr\u00e9ventive sur une surface donn\u00e9e",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "A_F_PREV",
"indexed": true,
"associated_template": []
@@ -32,7 +32,7 @@
"txt_idx": "pos_advice_reply",
"comment": "Suite \u00e0 une demande d'avis, les SRA \u00e9met un courrier signalant sa volont\u00e9 de prescrire un diagnostic ou une fouille sur l'emprise du projet en objet.",
"available": true,
- "intented_to": "F",
+ "intented_to_file": true,
"code": "AVIS_DIAG",
"indexed": false,
"associated_template": []
@@ -45,7 +45,7 @@
"txt_idx": "neg_advice_reply",
"comment": "Suite \u00e0 une demande d'avis, les SRA \u00e9met un courrier signalant sa volont\u00e9 de NE PAS prescrire un diagnostic ou une fouille sur l'emprise du projet en objet.",
"available": true,
- "intented_to": "F",
+ "intented_to_file": true,
"code": "Art_12_RAS",
"indexed": false,
"associated_template": []
@@ -58,7 +58,7 @@
"txt_idx": "excavation_autorization_order",
"comment": "Arr\u00eat\u00e9 qui donne l'autorisation \u00e0 un Am\u00e9nageur de faire ex\u00e9cuter par un Op\u00e9rateur agr\u00e9e sous la responsabilit\u00e9 d'un Responsable scientifique, une op\u00e9ration.",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "AUT_F_PREV",
"indexed": true,
"associated_template": []
@@ -71,7 +71,7 @@
"txt_idx": "prog_excav_autorization_order",
"comment": "Arr\u00eat\u00e9 donnant l'autorisation \u00e0 une responsable scientifique de fouiller sur un terrain donn\u00e9.",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "AUT_F_PROG",
"indexed": true,
"associated_template": []
@@ -84,7 +84,7 @@
"txt_idx": "reply_no_prescription",
"comment": "Suite \u00e0 une Saisine (art.8), envoi d'une r\u00e9ponse de non prescription",
"available": true,
- "intented_to": "F",
+ "intented_to_file": true,
"code": "RAS",
"indexed": false,
"associated_template": []
@@ -97,7 +97,7 @@
"txt_idx": "responsible_act",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "DESIGN_RS",
"indexed": true,
"associated_template": []
@@ -110,7 +110,7 @@
"txt_idx": "operator_designation_act",
"comment": "D\u00e9signation de l'op\u00e9rateur pour un diagnostic : utile dans le cas o\u00f9 un service territorial ET l'INRAP sont en m\u00eame temps comp\u00e9tents pour un territoire donn\u00e9.",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "DES_OPE",
"indexed": true,
"associated_template": []
@@ -123,7 +123,7 @@
"txt_idx": "thematic_survey_act",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "",
"indexed": true,
"associated_template": []
@@ -136,7 +136,7 @@
"txt_idx": "initial_act",
"comment": "Lorsque des op\u00e9rations sont r\u00e9alis\u00e9es par tranches successives, le calendrier pr\u00e9visionnel de leur r\u00e9alisation est communiqu\u00e9 au pr\u00e9fet de r\u00e9gion qui peut d\u00e9cider de prescrire les mesures pr\u00e9vues \u00e0 l'article R. 523-15 soit pour la totalit\u00e9 du projet, soit lors de l'ex\u00e9cution de chaque tranche. Dans ce dernier cas, il d\u00e9finit par arr\u00eat\u00e9 les d\u00e9lais de sa saisine et la nature des documents \u00e0 fournir.\r\nLes op\u00e9rations de diagnostic sont toutefois conduites pour l'ensemble du projet si la personne qui r\u00e9alise ce projet en fait la demande.\r\n",
"available": true,
- "intented_to": "F",
+ "intented_to_file": true,
"code": "A_INITIAL",
"indexed": true,
"associated_template": []
@@ -149,7 +149,7 @@
"txt_idx": "modif_act_ope",
"comment": "Modification d'un autre arr\u00eat\u00e9 concernant une op\u00e9ration",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "A_MODIF_SU",
"indexed": true,
"associated_template": []
@@ -162,7 +162,7 @@
"txt_idx": "modif_act_init",
"comment": "Modification d'un arr\u00eat\u00e9 d\u00e9finissant les d\u00e9lais de saisines (arr\u00eat\u00e9 initial)",
"available": true,
- "intented_to": "F",
+ "intented_to_file": true,
"code": "",
"indexed": true,
"associated_template": []
@@ -175,7 +175,7 @@
"txt_idx": "a_receipt",
"comment": "Document attestant de la r\u00e9ception d'un dossier",
"available": true,
- "intented_to": "F",
+ "intented_to_file": true,
"code": "AR",
"indexed": false,
"associated_template": [
@@ -192,7 +192,7 @@
"txt_idx": "info_pos",
"comment": "",
"available": true,
- "intented_to": "F",
+ "intented_to_file": true,
"code": "INFO",
"indexed": false,
"associated_template": []
@@ -205,7 +205,7 @@
"txt_idx": "info_ras",
"comment": "",
"available": true,
- "intented_to": "F",
+ "intented_to_file": true,
"code": "INFO_RAS",
"indexed": false,
"associated_template": []
@@ -218,7 +218,7 @@
"txt_idx": "sondage_act",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "Arr_sond",
"indexed": true,
"associated_template": []
@@ -231,7 +231,7 @@
"txt_idx": "ok_project_diag",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "C_PSTI_OK",
"indexed": false,
"associated_template": []
@@ -244,7 +244,7 @@
"txt_idx": "contractor_post_ope_mail",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "RAP_Amenag",
"indexed": false,
"associated_template": []
@@ -257,7 +257,7 @@
"txt_idx": "RAS_Post_DIAG",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "RAS_DIAG",
"indexed": false,
"associated_template": []
@@ -270,7 +270,7 @@
"txt_idx": "free_field",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "Lib_Terr",
"indexed": false,
"associated_template": []
@@ -283,7 +283,7 @@
"txt_idx": "cancel_act",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "ABROG",
"indexed": true,
"associated_template": []
@@ -296,7 +296,7 @@
"txt_idx": "CU_ok",
"comment": "",
"available": true,
- "intented_to": "F",
+ "intented_to_file": true,
"code": "CU_RAS",
"indexed": false,
"associated_template": []
@@ -309,7 +309,7 @@
"txt_idx": "pos_CU",
"comment": "",
"available": true,
- "intented_to": "F",
+ "intented_to_file": true,
"code": "CU_POSITIF",
"indexed": false,
"associated_template": []
@@ -322,7 +322,7 @@
"txt_idx": "project_modif_act",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "A_MODIF_PR",
"indexed": true,
"associated_template": []
@@ -335,7 +335,7 @@
"txt_idx": "archaeological_zoning",
"comment": "",
"available": true,
- "intented_to": "F",
+ "intented_to_file": true,
"code": "ZONAGE",
"indexed": true,
"associated_template": []
@@ -348,7 +348,7 @@
"txt_idx": "mail_diag",
"comment": "Courrier qui accompagne l'arr\u00eat\u00e9 de diagnostic envoy\u00e9 \u00e0 l'am\u00e9nageur",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "COUR_DIAG",
"indexed": false,
"associated_template": []
@@ -361,7 +361,7 @@
"txt_idx": "general_survey_act",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "PI",
"indexed": true,
"associated_template": []
@@ -374,7 +374,7 @@
"txt_idx": "diag_already",
"comment": "",
"available": true,
- "intented_to": "F",
+ "intented_to_file": true,
"code": "DIAG_EXIST",
"indexed": false,
"associated_template": []
@@ -387,7 +387,7 @@
"txt_idx": "diag_already_land",
"comment": "",
"available": true,
- "intented_to": "F",
+ "intented_to_file": true,
"code": "DIAG_dejaA",
"indexed": false,
"associated_template": []
@@ -400,7 +400,7 @@
"txt_idx": "land_plan_excavation_mail",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "C_Am_FOUIL",
"indexed": false,
"associated_template": []
@@ -413,7 +413,7 @@
"txt_idx": "town_planning_diag_mail",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "C_SI_DIAG",
"indexed": false,
"associated_template": []
@@ -426,7 +426,7 @@
"txt_idx": "terr_service_diag_mail",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "C_COLL_TER",
"indexed": false,
"associated_template": []
@@ -439,7 +439,7 @@
"txt_idx": "excavation_mail",
"comment": "Courrier \u00e0 l'am\u00e9nageur lui indiquant l'intention de prescrire une fouille directement sur un Dossier",
"available": true,
- "intented_to": "F",
+ "intented_to_file": true,
"code": "C_INT_pres",
"indexed": false,
"associated_template": []
@@ -452,7 +452,7 @@
"txt_idx": "mail_excavation_urbanism",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "C_SI_Fouil",
"indexed": false,
"associated_template": []
@@ -465,7 +465,7 @@
"txt_idx": "part_free_diag",
"comment": "Suite \u00e0 une demande de l'am\u00e9nageur, si une partie des terrains ne contient pas de vestiges, il est possible de faire une lib\u00e9ration partielle.",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "LIB_PART",
"indexed": false,
"associated_template": []
@@ -478,7 +478,7 @@
"txt_idx": "PV_CR",
"comment": "PV relatant une visite particuli\u00e8re de contr\u00f4le du SRA lors d'une op\u00e9ration d'arch\u00e9ologie",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "PV_CR",
"indexed": false,
"associated_template": []
@@ -491,7 +491,7 @@
"txt_idx": "pas_advice_reply_bis",
"comment": "Suite \u00e0 une demande d'avis, les SRA \u00e9met un courrier signalant sa volont\u00e9 de prescrire un diagnostic ou une fouille sur l'emprise du projet en objet.",
"available": true,
- "intented_to": "F",
+ "intented_to_file": true,
"code": "AVIS_DIAG2",
"indexed": false,
"associated_template": []
@@ -504,7 +504,7 @@
"txt_idx": "modif_project",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "MODIF_PSTI",
"indexed": false,
"associated_template": []
@@ -517,7 +517,7 @@
"txt_idx": "mail_confirm",
"comment": "(Art. R523-19 du code du patrimoine)\r\n\r\nLe pr\u00e9fet de r\u00e9gion dispose d'un d\u00e9lai de trois mois \u00e0 compter de la r\u00e9ception du rapport de diagnostic complet pour notifier le contenu des prescriptions post\u00e9rieures au diagnostic.\r\nLa date de r\u00e9ception du rapport de diagnostic complet est notifi\u00e9e par le pr\u00e9fet de r\u00e9gion \u00e0 l'autorit\u00e9 qui instruit la demande d'autorisation et \u00e0 l'am\u00e9nageur.\r\nDans le cas o\u00f9 le diagnostic a d\u00e9j\u00e0 \u00e9t\u00e9 r\u00e9alis\u00e9 en application de l'article R. 523-14, le d\u00e9lai de trois mois court \u00e0 compter de la r\u00e9ception du dossier par le pr\u00e9fet de r\u00e9gion dans les conditions pr\u00e9vues aux articles R. 523-9 et R. 523-10 ou de la confirmation par l'am\u00e9nageur de son intention de r\u00e9aliser les am\u00e9nagements, ouvrages ou travaux projet\u00e9s.\r\nA d\u00e9faut de notification dans ce d\u00e9lai, le pr\u00e9fet de r\u00e9gion est r\u00e9put\u00e9 avoir renonc\u00e9 \u00e0 \u00e9dicter de telles prescriptions.",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "CONFIRM",
"indexed": false,
"associated_template": []
@@ -530,7 +530,7 @@
"txt_idx": "report_post",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "DAPA_DIAG",
"indexed": false,
"associated_template": []
@@ -543,7 +543,7 @@
"txt_idx": "post_report_town",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "BE_MAIRIE",
"indexed": false,
"associated_template": []
@@ -556,7 +556,7 @@
"txt_idx": "post_report_inrap",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "INRAP_RAP",
"indexed": false,
"associated_template": []
@@ -569,7 +569,7 @@
"txt_idx": "bad_report",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "REFUS_RAPP",
"indexed": false,
"associated_template": []
@@ -582,7 +582,7 @@
"txt_idx": "AR_operator",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "AR_OPER",
"indexed": false,
"associated_template": []
@@ -595,7 +595,7 @@
"txt_idx": "ar_report_excavation",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "AR_FOUILLE",
"indexed": false,
"associated_template": []
@@ -608,7 +608,7 @@
"txt_idx": "OPE_sheetfile",
"comment": "",
"available": true,
- "intented_to": "O",
+ "intented_to_operation": true,
"code": "FICHE_OPE",
"indexed": false,
"associated_template": []
@@ -621,7 +621,7 @@
"txt_idx": "pos_advice_mh",
"comment": "",
"available": true,
- "intented_to": "F",
+ "intented_to_file": true,
"code": "AVIS_POS_M",
"indexed": false,
"associated_template": []
@@ -634,7 +634,7 @@
"txt_idx": "neg_advice_MH",
"comment": "",
"available": true,
- "intented_to": "F",
+ "intented_to_file": true,
"code": "AVIS_RAS_M",
"indexed": false,
"associated_template": []
@@ -647,7 +647,7 @@
"txt_idx": "loan_demand_receipt",
"comment": "",
"available": true,
- "intented_to": "TF",
+ "intented_to_treatment_request": true,
"code": "AR_demande",
"indexed": false,
"associated_template": []
@@ -660,7 +660,7 @@
"txt_idx": "observation_status",
"comment": "",
"available": true,
- "intented_to": "T",
+ "intented_to_treatment": true,
"code": "",
"indexed": false,
"associated_template": [
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:
diff --git a/archaeological_operations/migrations/0122_admin_act_many_intented_to.py b/archaeological_operations/migrations/0122_admin_act_many_intented_to.py
new file mode 100644
index 000000000..ede4ac1bc
--- /dev/null
+++ b/archaeological_operations/migrations/0122_admin_act_many_intented_to.py
@@ -0,0 +1,48 @@
+# Generated by Django 2.2.28 on 2025-03-17 17:52
+
+from django.db import migrations, models
+
+
+def migrate_intented_to(apps, __):
+ ActType = apps.get_model("archaeological_operations", "ActType")
+ for act in ActType.objects.all():
+ if act.intented_to == "F":
+ act.intented_to_file = True
+ elif act.intented_to == "O":
+ act.intented_to_operation = True
+ elif act.intented_to == "T":
+ act.intented_to_treatment = True
+ elif act.intented_to == "TF":
+ act.intented_to_treatment_request = True
+ act.save()
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_operations', '0121_ishtar_users'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='acttype',
+ name='intented_to_file',
+ field=models.BooleanField(default=False, verbose_name='Intented to archaeological file'),
+ ),
+ migrations.AddField(
+ model_name='acttype',
+ name='intented_to_operation',
+ field=models.BooleanField(default=False, verbose_name='Intented to operation'),
+ ),
+ migrations.AddField(
+ model_name='acttype',
+ name='intented_to_treatment',
+ field=models.BooleanField(default=False, verbose_name='Intented to treatment'),
+ ),
+ migrations.AddField(
+ model_name='acttype',
+ name='intented_to_treatment_request',
+ field=models.BooleanField(default=False, verbose_name='Intented to treatment request'),
+ ),
+ migrations.RunPython(migrate_intented_to)
+ ]
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 76e258994..171b60513 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -2820,7 +2820,18 @@ class ActType(GeneralType):
("T", _("Treatment")),
)
SERIALIZATION_EXCLUDE = ["associated_template"]
- intented_to = models.CharField(_("Intended to"), max_length=2, choices=TYPE)
+ intented_to = models.CharField(
+ _("Intended to"), max_length=2, choices=TYPE,
+ help_text=_("Deprecated: do not use")
+ )
+ intented_to_file = models.BooleanField(
+ _("Intented to archaeological file"), default=False)
+ intented_to_operation = models.BooleanField(
+ _("Intented to operation"), default=False)
+ intented_to_treatment = models.BooleanField(
+ _("Intented to treatment"), default=False)
+ intented_to_treatment_request = models.BooleanField(
+ _("Intented to treatment request"), default=False)
code = models.CharField(_("Code"), max_length=10, blank=True, null=True)
associated_template = models.ManyToManyField(
DocumentTemplate,
@@ -2886,7 +2897,6 @@ class AdministrativeAct(DocumentItem, BaseHistorizedItem, OwnPerms, ValueGetter,
]
EXTRA_REQUEST_KEYS = {
"act_object": "act_object__icontains",
- "act_type__intented_to": "act_type__intented_to",
"associated_file__general_contractor__attached_to": "associated_file__general_contractor__attached_to__pk",
"associated_file__name": "associated_file__name__icontains",
"associated_file__operations__code_patriarche": "associated_file__operations__code_patriarche",
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py
index f48048eec..57e71b256 100644
--- a/archaeological_operations/tests.py
+++ b/archaeological_operations/tests.py
@@ -4053,7 +4053,7 @@ class LabelTest(TestCase, OperationInitTest):
def create_administrativact(user, operation):
act_type, created = models.ActType.objects.get_or_create(
- txt_idx="act_type_O", intented_to="O"
+ txt_idx="act_type_O", intented_to_operation=True
)
dct = {
"history_modifier": user,
@@ -4511,7 +4511,7 @@ class OperationAdminActWizardCreationTest(WizardTest, OperationInitTest, TestCas
data = self.form_datas[0].form_datas
data["selec-operation_administrativeactop"]["pk"] = ope.pk
- act = models.ActType.objects.filter(intented_to="O").all()[0].pk
+ act = models.ActType.objects.filter(intented_to_operation=True).all()[0].pk
data["administrativeact-operation_administrativeactop"]["act_type"] = act
super(OperationAdminActWizardCreationTest, self).pre_wizard()