agendas: add a flag to enable check of future events (#75277)

This commit is contained in:
Lauréline Guérin 2023-03-14 14:26:53 +01:00
parent 970ba42075
commit 0a9e36883c
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
5 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,18 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('agendas', '0146_event_bigautofield'),
]
operations = [
migrations.AddField(
model_name='agenda',
name='enable_check_for_future_events',
field=models.BooleanField(
default=False, verbose_name='Enable the check of bookings when event has not passed'
),
),
]

View File

@ -227,6 +227,9 @@ class Agenda(models.Model):
disable_check_update = models.BooleanField(
_('Prevent the check of bookings when event was marked as checked'), default=False
)
enable_check_for_future_events = models.BooleanField(
_('Enable the check of bookings when event has not passed'), default=False
)
booking_check_filters = models.CharField(
_('Filters'),
max_length=250,

View File

@ -1415,6 +1415,7 @@ class AgendaBookingCheckSettingsForm(forms.ModelForm):
'booking_check_filters',
'mark_event_checked_auto',
'disable_check_update',
'enable_check_for_future_events',
]

View File

@ -113,6 +113,7 @@
{% endwith %}
<li>{% trans "Automatically mark event as checked when all bookings have been checked:" %} {{ agenda.mark_event_checked_auto|yesno }}</li>
<li>{% trans "Prevent the check of bookings when event was marked as checked:" %} {{ agenda.disable_check_update|yesno }}</li>
<li>{% trans "Enable the check of bookings when event has not passed:" %} {{ agenda.enable_check_for_future_events|yesno }}</li>
</ul>
<div class="panel--buttons">
<a rel="popup" class="button" href="{% url 'chrono-manager-agenda-booking-check-settings' pk=object.pk %}">{% trans 'Configure' %}</a>

View File

@ -689,6 +689,14 @@ def test_options_agenda_booking_check_options(app, admin_user):
agenda.refresh_from_db()
assert agenda.disable_check_update is True
# check enable check future events
assert agenda.enable_check_for_future_events is False
resp = app.get(url)
resp.form['enable_check_for_future_events'] = True
resp = resp.form.submit()
agenda.refresh_from_db()
assert agenda.enable_check_for_future_events is True
# check kind
agenda.kind = 'meetings'
agenda.save()