c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #24710
[Bug 781127] Re: [v5]rml report seems to cache image data
*** This bug is a duplicate of bug 640677 ***
https://bugs.launchpad.net/bugs/640677
** Summary changed:
- rml report seems to cache image data
+ [v5]rml report seems to cache image data
** This bug has been marked a duplicate of bug 640677
[5.0][RML] Node image in loop always prints the same image
* You can subscribe to bug 640677 by following this link: https://bugs.launchpad.net/openobject-server/+bug/640677/+subscribe
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/781127
Title:
[v5]rml report seems to cache image data
Status in OpenERP Modules (addons):
New
Bug description:
Hi,
I'm still running Open ERP 5, and would like to design a new rml
template. The rml code seems just fine, but the images it contain do
not 'loop'.
It's a sale.order report that would show images together with product
description. There might be several images for a given product named
pict1-pict9, and a custom method loads their data. the situation is
that only the first image for a given index is shown even though the
method shows loading of all the images.
<code>
<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>
<code>
and the custom method in my report file is
<code>
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
</code>
I've posted the same question at
http://stackoverflow.com/q/5950040/245493
References