[IMP] snailmail: Only resend concerned letter from format error
Previously, when updating and resending a snailmail through the chatter, it would re-send every snailmail letters in the DB with an error. This behaviour lead to users mistakenly sending dozens of unwanted snailmails, expecting to re-send the one they were currently on. This commit changes that by only sending the relevant letter(s). closes odoo/odoo#146078 X-original-commit: 43a56e84919604608d12bf3d8528339733fc79d8 Signed-off-by: Louis Baudoux (lba) <lba@odoo.com> Signed-off-by: Solan Delvenne (sode) <sode@odoo.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
class SnailmailLetterFormatError(models.TransientModel):
|
||||
@@ -16,9 +15,7 @@ class SnailmailLetterFormatError(models.TransientModel):
|
||||
|
||||
def update_resend_action(self):
|
||||
self.env.company.write({'snailmail_cover': self.snailmail_cover})
|
||||
letters_to_resend = self.env['snailmail.letter'].search([
|
||||
('error_code', '=', 'FORMAT_ERROR'),
|
||||
])
|
||||
letters_to_resend = self.message_id.letter_ids
|
||||
for letter in letters_to_resend:
|
||||
old_attachment = letter.attachment_id
|
||||
letter.attachment_id = False
|
||||
|
||||
Reference in New Issue
Block a user