[FIX] account: restore add_banner() method
Since this commit : 7d69a28f0710ffc27979f6e977997f972bc129bb, the add_banner() method is no longer executed, which disables a recently added feature (see here : https://github.com/odoo/odoo/pull/84542). The goal here is simply to restore it. closes odoo/odoo#93860 X-original-commit: 29d3d5a3b5286fa6db625b3910ad325ed84472d8 Signed-off-by: Laurent Smet <las@odoo.com>
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import io
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
from odoo import models, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools import pdf
|
||||
|
||||
|
||||
class IrActionsReport(models.Model):
|
||||
@@ -25,10 +25,15 @@ class IrActionsReport(models.Model):
|
||||
|
||||
collected_streams = OrderedDict()
|
||||
for invoice in invoices:
|
||||
if invoice.message_main_attachment_id:
|
||||
attachment = invoice.message_main_attachment_id
|
||||
if attachment:
|
||||
stream = io.BytesIO(attachment.raw)
|
||||
if attachment.mimetype == 'application/pdf':
|
||||
record = self.env[attachment.res_model].browse(attachment.res_id)
|
||||
stream = pdf.add_banner(stream, record.name, logo=True)
|
||||
collected_streams[invoice.id] = {
|
||||
'stream': io.BytesIO(invoice.message_main_attachment_id.raw),
|
||||
'attachment': invoice.message_main_attachment_id,
|
||||
'stream': stream,
|
||||
'attachment': attachment,
|
||||
}
|
||||
return collected_streams
|
||||
|
||||
|
||||
Reference in New Issue
Block a user