Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
1779 Vistas

Hi all, I'm trying to put image (client signature) inside pdf quote builder but without luck. Did anybody know the trick how to do this?  I made this simple extension to enrich PDF with values. If I use form field in PDF I see base64 string. If I use image tag it will remains empty. 

from odoo import models


class IrActionsReport(models.Model):
    _inherit = 'ir.actions.report'

    def _get_form_fields_mapping(self, order, doc_line_id_mapping=None):
        result = super()._get_form_fields_mapping(order, doc_line_id_mapping=doc_line_id_mapping)
        result.update({
            'signed_on': order.signed_on,
            'date_order': order.date_order,
            'customer_signature': order.signature,
            'user_signature': order.user_id.sign_signature,
        })

        return result

Avatar
Descartar
Mejor respuesta

Hello Stanislav Kurniec,


Did you tried with converting order signature in base64 

signature_image = order.signature.decode('base64')
signature_base64 = base64.b64encode(signature_image).decode('utf-8')

use signature_base64 in result.



I hope this will help you

Thanks,

Vimal Rughani (Founder and CTO)

Himanjali Intelligent Automation Pvt Ltd

Contact: +91- 972-606-7737

Emailhello@himanjali.com 

NewsletterThe Odoo Scoop

Websitewww.himanjali.com

 


Avatar
Descartar
Mejor respuesta

Did you solve it?

Avatar
Descartar
Autor

No I didn't but in Odoo 18 it should be possible to require signature almost every where so I hope this will solved it. Maybe if you try to dig inside signature there is some way how Odoo adds some area to PDF and then fill it with image maybe this will be the way how to do it.
I have data but I didn't find out the way how to correctly display it inside PDF.

Publicaciones relacionadas Respuestas Vistas Actividad
3
abr 24
2040
1
dic 24
1218
6
dic 24
4070
1
mar 24
2415
0
ago 25
69