Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
1793 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Jawaban Terbai

Did you solve it?

Avatar
Buang
Penulis

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.

Post Terkait Replies Tampilan Aktivitas
3
Apr 24
2054
1
Des 24
1248
6
Des 24
4095
1
Mar 24
2432
3
Agu 25
186