From 174fce0c023845a6cbfcc2c4de97610438032b89 Mon Sep 17 00:00:00 2001 From: Ayushi Gorai Date: Thu, 18 May 2023 09:04:37 +0000 Subject: [PATCH] [FIX] account: prevent error will uploading empty text attachment in invoice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the user uploads an empty text file in the invoice it generates an attribute error with 'bool' object getting no attribute 'startswith'. Steps to produce:- - Install 'account' - Go to 'Invoice' - Create an invoice with an empty .txt attachment in the chatter section - Click 'Send' - Traceback is generated Applying this commit will fix this issue. sentry-4187919992 closes odoo/odoo#122103 X-original-commit: 7a12da836fa9926e12b15484aad77224cb75d3a3 Signed-off-by: William André (wan) --- addons/account/models/ir_attachment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/ir_attachment.py b/addons/account/models/ir_attachment.py index 518fdc6001f..9bb3befbcc7 100644 --- a/addons/account/models/ir_attachment.py +++ b/addons/account/models/ir_attachment.py @@ -100,7 +100,7 @@ class IrAttachment(models.Model): # XML attachments received by mail have a 'text/plain' mimetype (cfr. context key: # 'attachments_mime_plainxml'). Therefore, if content start with '