forked from CGM_Public/pretix_original
Sendmail: Fix selector for pending/overdue for scheduled messages (Z#23202906) (#5338)
* Sendmail: Fix selector for pending/overdue for scheduled messages (Z#287303) * isort * Apply suggestions from code review --------- Co-authored-by: Raphael Michel <michel@rami.io>
This commit is contained in:
@@ -389,7 +389,7 @@ class RuleForm(FormPlaceholderMixin, I18nModelForm):
|
||||
choices.insert(0, ('n__pending_approval', _('approval pending')))
|
||||
if not self.event.settings.get('payment_term_expire_automatically', as_type=bool):
|
||||
choices.append(
|
||||
('p__overdue', _('pending with payment overdue'))
|
||||
('n__pending_overdue', _('pending with payment overdue'))
|
||||
)
|
||||
self.fields['restrict_to_status'] = forms.MultipleChoiceField(
|
||||
label=pgettext_lazy('sendmail_from', 'Restrict to orders with status'),
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# Generated by Django 4.2.15 on 2025-08-01 13:42
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def migrate_pending_overdue(apps, schema_editor):
|
||||
Rule = apps.get_model("sendmail", "Rule")
|
||||
for r in Rule.objects.filter(restrict_to_status__icontains="p__overdue"):
|
||||
rts = r.restrict_to_status
|
||||
rts.remove('p__overdue')
|
||||
rts.append('n__pending_overdue')
|
||||
r.restrict_to_status = rts
|
||||
|
||||
r.save(update_fields=["restrict_to_status"])
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("sendmail", "0009_auto_20241113_1343"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
migrate_pending_overdue,
|
||||
migrations.RunPython.noop,
|
||||
)
|
||||
]
|
||||
Reference in New Issue
Block a user