Skip to content
Snippets Groups Projects
Commit 5578eca0 authored by Arthur (goa)'s avatar Arthur (goa)
Browse files

[FIX] snailmail: dont resend without credits


We are spammed by some accounts that don't have credits anymore.

With this commit, when we try to send letters from the cron, whenever we
meet the CREDIT_ERROR error_code, we stop trying to send the letter.

task-2930455

closes odoo/odoo#103489

X-original-commit: f1fed40e
Signed-off-by: default avatarFlorian Daloze (fda) <fda@odoo.com>
parent eb39622c
Branches
Tags
No related merge requests found
......@@ -403,6 +403,8 @@ class SnailmailLetter(models.Model):
])
for letter in letters_send:
letter._snailmail_print()
if letter.error_code == 'CREDIT_ERROR':
break # avoid spam
# Commit after every letter sent to avoid to send it again in case of a rollback
if autocommit:
self.env.cr.commit()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment