diff --git a/geocity/apps/submissions/forms.py b/geocity/apps/submissions/forms.py index 903150034..37dd73fbd 100644 --- a/geocity/apps/submissions/forms.py +++ b/geocity/apps/submissions/forms.py @@ -1836,6 +1836,7 @@ def __init__(self, user, submission, *args, **kwargs): user, submission ): self.fields["comment_is_visible_by_author"].disabled = True + self.fields["comment_is_visible_in_reports"].disabled = True self.fields["validation_status"].choices = [ ( @@ -1851,11 +1852,13 @@ class Meta: "validation_status", "comment", "comment_is_visible_by_author", + "comment_is_visible_in_reports", ] widgets = { "validation_status": forms.RadioSelect(), "comment": forms.Textarea(attrs={"rows": 3}), "comment_is_visible_by_author": forms.CheckboxInput(), + "comment_is_visible_in_reports": forms.CheckboxInput(), } @@ -2386,7 +2389,12 @@ def get_submission_forms(submission): class SubmissionValidationsForm(forms.ModelForm): class Meta: model = models.SubmissionValidation - fields = ["department", "comment", "comment_is_visible_by_author"] + fields = [ + "department", + "comment", + "comment_is_visible_by_author", + "comment_is_visible_in_reports", + ] def __init__(self, *args, **kwargs): super(SubmissionValidationsForm, self).__init__(*args, **kwargs) diff --git a/geocity/apps/submissions/migrations/0031_historicalsubmissionvalidation_comment_is_visible_in_reports_and_more.py b/geocity/apps/submissions/migrations/0031_historicalsubmissionvalidation_comment_is_visible_in_reports_and_more.py new file mode 100644 index 000000000..98758454c --- /dev/null +++ b/geocity/apps/submissions/migrations/0031_historicalsubmissionvalidation_comment_is_visible_in_reports_and_more.py @@ -0,0 +1,45 @@ +# Generated by Django 4.2.11 on 2024-06-05 12:36 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("submissions", "0030_alter_servicefeetype_fix_price_editable"), + ] + + operations = [ + migrations.AddField( + model_name="historicalsubmissionvalidation", + name="comment_is_visible_in_reports", + field=models.BooleanField( + default=True, + verbose_name="Commentaire visible dans le modèle d'impression", + ), + ), + migrations.AddField( + model_name="submissionvalidation", + name="comment_is_visible_in_reports", + field=models.BooleanField( + default=True, + verbose_name="Commentaire visible dans le modèle d'impression", + ), + ), + migrations.AlterField( + model_name="historicalsubmissionvalidation", + name="comment_is_visible_by_author", + field=models.BooleanField( + default=False, + verbose_name="Commentaire visible dans le résumé pour l'auteur de la demande", + ), + ), + migrations.AlterField( + model_name="submissionvalidation", + name="comment_is_visible_by_author", + field=models.BooleanField( + default=False, + verbose_name="Commentaire visible dans le résumé pour l'auteur de la demande", + ), + ), + ] diff --git a/geocity/apps/submissions/models.py b/geocity/apps/submissions/models.py index 209c54941..bcb812653 100644 --- a/geocity/apps/submissions/models.py +++ b/geocity/apps/submissions/models.py @@ -2046,7 +2046,11 @@ class SubmissionValidation(models.Model): blank=True, ) comment_is_visible_by_author = models.BooleanField( - _("Commentaire visible par l'auteur de la demande"), default=True + _("Commentaire visible dans le résumé pour l'auteur de la demande"), + default=False, + ) + comment_is_visible_in_reports = models.BooleanField( + _("Commentaire visible dans le modèle d'impression"), default=True ) validated_by = models.ForeignKey( User, verbose_name=_("Validé par"), null=True, on_delete=models.SET_NULL diff --git a/geocity/apps/submissions/templates/submissions/submission_detail.html b/geocity/apps/submissions/templates/submissions/submission_detail.html index df2a8402b..441a19e02 100644 --- a/geocity/apps/submissions/templates/submissions/submission_detail.html +++ b/geocity/apps/submissions/templates/submissions/submission_detail.html @@ -219,7 +219,8 @@

{% translate "Validation" %}

{% if validation.comment_is_visible_by_author or current_user != submission.author %}
{% translate "Commentaire" %}:
{{ validation.comment|linebreaksbr }}
{% if current_user != submission.author %} -
{% translate "Commentaire visible par l'auteur de la demande" %}:
+ {% comment %} résumé {% endcomment %} +
{% translate "Visible dans le résumé pour l'auteur de la demande" %}:
{% if validation.comment_is_visible_by_author %} @@ -227,6 +228,15 @@

{% translate "Validation" %}

{% endif %}
+ {% comment %} modèle d'impression {% endcomment %} +
{% translate "Visible dans le modèle d'impression" %}:
+
+ {% if validation.comment_is_visible_in_reports %} + + {% else %} + + {% endif %} +
{% endif %} {% endif %} {% endif %}