[FIX] base: Preserve loosing embedded files when printing 1 attachment
With the reload from attachment ticked (attachment_use) when dealing with a single pdf, the attachment's content must be returned without calling _merge_pdfs in order to preserve the embedded files. Since PyPDF2 doesn't support completely the embedded files, there are simply dropped with creating a new pdf in _merge_pdfs even with a single attachement. closes odoo/odoo#41246 Issue: https://github.com/odoo/odoo/issues/41079 X-original-commit: a8f96bc7f35d047999cd16b7dd03bcddd3c32263 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
@@ -559,8 +559,10 @@ class IrActionsReport(models.Model):
|
||||
pass
|
||||
|
||||
# Check special case having only one record with existing attachment.
|
||||
# In that case, return directly the attachment content.
|
||||
# In that way, we also ensure the embedded files are well preserved.
|
||||
if len(save_in_attachment) == 1 and not pdf_content:
|
||||
return self._merge_pdfs(list(save_in_attachment.values()))
|
||||
return list(save_in_attachment.values())[0].getvalue()
|
||||
|
||||
# Create a list of streams representing all sub-reports part of the final result
|
||||
# in order to append the existing attachments and the potentially modified sub-reports
|
||||
|
||||
Reference in New Issue
Block a user