[FIX] account: send and print invoice without attachments
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) <wan@odoo.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user