0001-lingo-fix-notifications-expiration-for-expired-invoi.patch
combo/apps/lingo/models.py | ||
---|---|---|
245 | 245 |
notification_reminder_id = self.get_notification_reminder_id(invoice) |
246 | 246 |
if invoice.payment_limit_date < today: |
247 | 247 |
# invoice is out of date |
248 |
Notification.forget(user, notification_id)
|
|
249 |
Notification.forget(user, notification_reminder_id)
|
|
248 |
Notification.objects.find(user, notification_id).forget()
|
|
249 |
Notification.objects.find(user, notification_reminder_id).forget()
|
|
250 | 250 |
else: |
251 | 251 |
# invoice can be paid |
252 | 252 |
if invoice.payment_limit_date >= today + remind_delta: |
tests/test_notification.py | ||
---|---|---|
316 | 316 |
'created': creation_date, |
317 | 317 |
'pay_limit_date': pay_limit_date, |
318 | 318 |
'has_pdf': False, |
319 |
}, |
|
320 |
{ |
|
321 | ||
322 |
'id': 'O5', |
|
323 |
'label': '050505', |
|
324 |
'total_amount': '24', |
|
325 |
'amount': '24', |
|
326 |
'created': (invoice_now - timedelta(days=25)).date().isoformat(), |
|
327 |
'pay_limit_date': (invoice_now - timedelta(days=10)).date().isoformat(), |
|
328 |
'has_pdf': False, |
|
319 | 329 |
} |
320 | 330 |
] |
321 | 331 |
}, |
... | ... | |
385 | 395 |
assert Notification.objects.exclude(external_id__startswith='invoice-%s:reminder-' % regie.slug) \ |
386 | 396 |
.visible().count() == 0 |
387 | 397 |
assert Notification.objects.filter(external_id__startswith='invoice-%s:reminder-' % regie.slug) \ |
388 |
.visible().new().count() == 2
|
|
389 |
assert Notification.objects.count() == 4
|
|
398 |
.visible().new().count() == 3
|
|
399 |
assert Notification.objects.count() == 5
|
|
390 | 400 | |
391 | 401 |
# url appeared on new reminder notifications |
392 |
assert len([notif for notif in Notification.objects.all() if notif.url == page.get_online_url()]) == 2
|
|
402 |
assert len([notif for notif in Notification.objects.all() if notif.url == page.get_online_url()]) == 3
|
|
393 | 403 | |
394 | 404 |
# be sure the are no more reminders created |
395 | 405 |
regie.notify_new_remote_invoices() |
396 |
assert Notification.objects.count() == 4 |
|
406 |
assert Notification.objects.count() == 5 |
|
397 |
- |