Compare commits

...

3 Commits

Author SHA1 Message Date
Raphael Michel
803fd15583 Apply suggestions from code review 2025-08-04 15:05:22 +02:00
Martin Gross
2a45d84c90 isort 2025-08-01 15:56:14 +02:00
Martin Gross
be0c6ed354 Sendmail: Fix selector for pending/overdue for scheduled messages (Z#287303) 2025-08-01 15:53:25 +02:00
2 changed files with 29 additions and 1 deletions

View File

@@ -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'),

View File

@@ -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,
)
]