跳至内容
菜单
此问题已终结
2 回复
1459 查看

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

形象
丢弃
最佳答案

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

 


形象
丢弃
最佳答案

Did you solve it?

形象
丢弃
编写者

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.

相关帖文 回复 查看 活动
3
4月 24
1663
1
12月 24
909
6
12月 24
3464
1
3月 24
2003
0
6月 25
81