From 0851a824c86711daba603e3490ffd3df4557d5ce Mon Sep 17 00:00:00 2001 From: althaf shaik Date: Thu, 13 Jul 2023 12:11:26 +0000 Subject: [PATCH] [FIX] account: send and print invoice without attachments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This traceback raises when user tries to send an invoice without attachments. To reproduce this issue: 1) Install 'Accounting' 2) Open any existing 'Invoice' Note:- Invoice should not be in 'Draft' 3) Click 'Send & Print ' button an wizard will be opened. 4) Click on 'Send & Print' button of wizard. 5) Now repeat the step 3 6) This time delete the Invoice Attachment and click on 'Send & Print' button of wizard. Error: 'A traceback appears': 'can only concatenate list (not "bool") to list' On '_get_mail_params' method 'attachment_ids' is getting values by concatenating 'mail_attachments_widget' and 'invoice_extra_attachments_data'. See:- https://github.com/odoo/odoo/blob/27c1384e1209339158f56c82bebf99a5b64811f4/addons/account/wizard/account_move_send.py#L434-L448 Because of user delete the 'Invoice attachments' in wizard, 'mail_attachments_widget' will return false and it leads to above traceback. Sentry-4305060652 closes odoo/odoo#133953 X-original-commit: f08da6fdfa881ec3e80d6fc14dddaa8df3c529ed Signed-off-by: William André (wan) --- addons/account/wizard/account_move_send.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/wizard/account_move_send.py b/addons/account/wizard/account_move_send.py index 21403052b71..fdb44b1b771 100644 --- a/addons/account/wizard/account_move_send.py +++ b/addons/account/wizard/account_move_send.py @@ -457,7 +457,7 @@ class AccountMoveSend(models.Model): # We must ensure the newly created PDF are added. At this point, the PDF has been generated but not added # to 'mail_attachments_widget'. seen_attachment_ids = set() - for attachment_data in self._get_invoice_extra_attachments_data(self.move_ids) + self.mail_attachments_widget: + for attachment_data in self._get_invoice_extra_attachments_data(self.move_ids) + (self.mail_attachments_widget or []): try: attachment_id = int(attachment_data['id']) except ValueError: