mirror of
https://github.com/Kalenis/kalenislims.git
synced 2023-12-14 07:13:04 +01:00
lims_report_html: add function to get images
This commit is contained in:
parent
66962b8386
commit
bb2ff10309
|
@ -20,14 +20,9 @@
|
|||
{% block report_header %}
|
||||
<table style="width:100%;">
|
||||
<tr>
|
||||
<td style="width:50%;">
|
||||
<td style="width:100%;">
|
||||
{% if company.logo %}
|
||||
<!-- COMPANY LOGO -->
|
||||
{% endif %}
|
||||
</td>
|
||||
<td style="width:50%;">
|
||||
{% if enac == 'True' %}
|
||||
<!-- ENAC LOGO -->
|
||||
<img src="{{ get_image(company.logo) }}" alt="{{ company.party.rec_name }}" style="width:300px; height:75px"/>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -1207,6 +1202,7 @@
|
|||
<tr>
|
||||
<td style="width:100%;">
|
||||
<hr/>
|
||||
<p class="text-center"><img src="{{ get_image(signature) }}" alt="signature" style="width:100px; height:100px;"/></p>
|
||||
<p class="text-center">{{ signer }}</p>
|
||||
<p class="text-center">{{ signer_role }}</p>
|
||||
</td>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# This file is part of lims_report_html module for Tryton.
|
||||
# The COPYRIGHT file at the top level of this repository contains
|
||||
# the full copyright notices and license terms.
|
||||
from base64 import b64encode
|
||||
|
||||
from trytond.model import fields
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
|
@ -136,7 +137,15 @@ class ResultReport(metaclass=PoolMeta):
|
|||
context = cls.get_context(records, data)
|
||||
context.update({
|
||||
'report': action,
|
||||
'get_image': cls.get_image,
|
||||
})
|
||||
res = report_template.render(**context)
|
||||
# print('TEMPLATE:\n', res)
|
||||
return res
|
||||
|
||||
@classmethod
|
||||
def get_image(cls, image):
|
||||
if not image:
|
||||
return ''
|
||||
b64_image = b64encode(image).decode()
|
||||
return 'data:image/png;base64,%s' % b64_image
|
||||
|
|
Loading…
Reference in a new issue