I했습니다 내 판매 주문 템플릿에서 다음 RML :openerp 보고서는 이미지 데이터를 캐시하는 것
<section>
[[ repeatIn(o.order_line, 'l') ]]
<blockTable colWidths="250.0,92.0,21.0,80.0,85.0" style="Táblázat2">
<tr>
<td>
<para style="P13">[[ l.name ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(l.product_uos and l.product_uos_qty or l.product_uom_qty, digits=0) ]] </para>
</td>
<td>
<para style="P13">[[ l.product_uos and l.product_uos.name or l.product_uom.name ]]</para>
</td>
<td>
<para style="P9">[[ formatLang(l.price_unit, digits=0) ]] [[ o.pricelist_id.currency_id.name ]]</para>
</td>
<td>
<para style="P9">[[ formatLang(l.price_subtotal, digits=0) ]] [[ o.pricelist_id.currency_id.name ]]</para>
</td>
</tr>
</blockTable>
<para style="P15">
[[ l.product_id.description_sale ]]
</para>
<image height="260" width="520">[[ o.state=='draft' and get_product_attachment(1, l.product_id) or removeParentNode('image')]]</image>
</section>
(.. 다른 인덱스와 같은 많은 이미지 태그가 난 그냥 코드를 제거했다가 있습니다)
다음 내 보고서 생성기는
def get_product_attachment(self, index, product):
context = {}
attach = self.pool.get('ir.attachment').search(self.cr, self.uid, [('res_id','=',product.id), ('name','ilike', 'pict%d' % index)])
attach = attach and self.pool.get('ir.attachment').browse(self.cr, self.uid, attach[0]) or False
if attach:
print 'a', product.id, index, attach, attach.datas[:30]
return attach.datas
else:
return False
이 모든 일이 잘 작동하는 것 같다 정의 인쇄 문은 다른 결과가 아니라 최종 PDF 파일을 보여줍니다!
pdf 모든 이미지는 주어진 색인에 대해 동일합니다.
아이디어가 있으십니까?
이것은 [openerp의 버그] (https://bugs.launchpad.net/openobject-server/+bug/640677)로 인식되어 이미 수정되었습니다. – Akasha