forked from CGM_Public/pretix_original
Add Order.custom_followup_at (#2124)
This commit is contained in:
@@ -205,6 +205,10 @@ class OrderFilterForm(FilterForm):
|
||||
('na', _('Approved, payment pending')),
|
||||
('pa', _('Approval pending')),
|
||||
)),
|
||||
(_('Follow-up date'), (
|
||||
('custom_followup_at', _('Follow-up configured')),
|
||||
('custom_followup_due', _('Follow-up due')),
|
||||
)),
|
||||
('testmode', _('Test mode')),
|
||||
),
|
||||
required=False,
|
||||
@@ -324,6 +328,14 @@ class OrderFilterForm(FilterForm):
|
||||
status=Order.STATUS_PENDING,
|
||||
require_approval=False
|
||||
)
|
||||
elif s == 'custom_followup_at':
|
||||
qs = qs.filter(
|
||||
custom_followup_at__isnull=False
|
||||
)
|
||||
elif s == 'custom_followup_due':
|
||||
qs = qs.filter(
|
||||
custom_followup_at__lte=now().astimezone(get_current_timezone()).date()
|
||||
)
|
||||
elif s == 'testmode':
|
||||
qs = qs.filter(
|
||||
testmode=True
|
||||
|
||||
@@ -230,12 +230,13 @@ class ExporterForm(forms.Form):
|
||||
class CommentForm(I18nModelForm):
|
||||
class Meta:
|
||||
model = Order
|
||||
fields = ['comment', 'checkin_attention']
|
||||
fields = ['comment', 'checkin_attention', 'custom_followup_at']
|
||||
widgets = {
|
||||
'comment': forms.Textarea(attrs={
|
||||
'rows': 3,
|
||||
'class': 'helper-width-100',
|
||||
}),
|
||||
'custom_followup_at': DatePickerWidget(),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -360,6 +360,7 @@ def pretixcontrol_logentry_display(sender: Event, logentry: LogEntry, **kwargs):
|
||||
'pretix.event.order.invoice.regenerated': _('The invoice has been regenerated.'),
|
||||
'pretix.event.order.invoice.reissued': _('The invoice has been reissued.'),
|
||||
'pretix.event.order.comment': _('The order\'s internal comment has been updated.'),
|
||||
'pretix.event.order.custom_followup_at': _('The order\'s follow-up date has been updated.'),
|
||||
'pretix.event.order.checkin_attention': _('The order\'s flag to require attention at check-in has been '
|
||||
'toggled.'),
|
||||
'pretix.event.order.payment.changed': _('A new payment {local_id} has been started instead of the previous one.'),
|
||||
|
||||
@@ -890,10 +890,9 @@
|
||||
<form class="form" method="post"
|
||||
action="{% url "control:event.order.comment" event=request.event.slug organizer=request.event.organizer.slug code=order.code %}">
|
||||
{% csrf_token %}
|
||||
<div class="row">
|
||||
{% bootstrap_field comment_form.comment layout="horizontal" show_help=True show_label=False horizontal_field_class="col-md-12" %}
|
||||
{% bootstrap_field comment_form.checkin_attention layout="horizontal" show_help=True show_label=False horizontal_field_class="col-md-12" %}
|
||||
</div>
|
||||
{% bootstrap_field comment_form.comment show_help=True show_label=False %}
|
||||
{% bootstrap_field comment_form.custom_followup_at %}
|
||||
{% bootstrap_field comment_form.checkin_attention show_help=True show_label=False %}
|
||||
<button class="btn btn-default">
|
||||
{% trans "Update comment" %}
|
||||
</button>
|
||||
|
||||
@@ -134,6 +134,11 @@
|
||||
{% if o.testmode %}
|
||||
<span class="label label-warning">{% trans "TEST MODE" %}</span>
|
||||
{% endif %}
|
||||
{% if o.custom_followup_due %}
|
||||
<span class="label label-danger">{% blocktrans with date=o.custom_followup_at|date:"SHORT_DATE_FORMAT" context "followup" %}TODO {{ date }}{% endblocktrans %}</span>
|
||||
{% elif o.custom_followup_at %}
|
||||
<span class="label label-default">{% blocktrans with date=o.custom_followup_at|date:"SHORT_DATE_FORMAT" context "followup" %}TODO {{ date }}{% endblocktrans %}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ o.email|default_if_none:"" }}
|
||||
|
||||
@@ -69,6 +69,11 @@
|
||||
{% if o.testmode %}
|
||||
<span class="label label-warning">{% trans "TEST MODE" %}</span>
|
||||
{% endif %}
|
||||
{% if o.custom_followup_due %}
|
||||
<span class="label label-danger">{% blocktrans with date=o.custom_followup_at|date:"SHORT_DATE_FORMAT" context "followup" %}TODO {{ date }}{% endblocktrans %}</span>
|
||||
{% elif o.custom_followup_at %}
|
||||
<span class="label label-default">{% blocktrans with date=o.custom_followup_at|date:"SHORT_DATE_FORMAT" context "followup" %}TODO {{ date }}{% endblocktrans %}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ o.event.name }}</td>
|
||||
<td>
|
||||
|
||||
@@ -303,6 +303,7 @@ class OrderDetail(OrderView):
|
||||
ctx['invoices'] = list(self.order.invoices.all().select_related('event'))
|
||||
ctx['comment_form'] = CommentForm(initial={
|
||||
'comment': self.order.comment,
|
||||
'custom_followup_at': self.order.custom_followup_at,
|
||||
'checkin_attention': self.order.checkin_attention
|
||||
})
|
||||
ctx['display_locale'] = dict(settings.LANGUAGES)[self.object.locale or self.request.event.settings.locale]
|
||||
@@ -487,12 +488,21 @@ class OrderComment(OrderView):
|
||||
'new_comment': form.cleaned_data.get('comment')
|
||||
})
|
||||
|
||||
if form.cleaned_data.get('custom_followup_at') != self.order.custom_followup_at:
|
||||
self.order.custom_followup_at = form.cleaned_data.get('custom_followup_at')
|
||||
self.order.log_action('pretix.event.order.custom_followup_at', user=self.request.user, data={
|
||||
'new_custom_followup_at': form.cleaned_data.get('custom_followup_at')
|
||||
})
|
||||
|
||||
if form.cleaned_data.get('checkin_attention') != self.order.checkin_attention:
|
||||
self.order.checkin_attention = form.cleaned_data.get('checkin_attention')
|
||||
self.order.log_action('pretix.event.order.checkin_attention', user=self.request.user, data={
|
||||
'new_value': form.cleaned_data.get('checkin_attention')
|
||||
})
|
||||
self.order.save(update_fields=['checkin_attention', 'comment'])
|
||||
print(self.order.custom_followup_at)
|
||||
self.order.save(update_fields=['checkin_attention', 'comment', 'custom_followup_at'])
|
||||
self.order.refresh_from_db()
|
||||
print(self.order.custom_followup_at)
|
||||
messages.success(self.request, _('The comment has been updated.'))
|
||||
else:
|
||||
messages.error(self.request, _('Could not update the comment.'))
|
||||
|
||||
Reference in New Issue
Block a user