问题描述
如何在购买报告中添加空白行?而且不知道blank_line是否执行完美.我点击了此链接[Openerp购买报告] [1] [1]: http://forum.openerp .com/forum/topic8508.html 代码:
How can i add empty blank rows in purchase report? and dont know if blank_line is executing perfectly. i followed this link [Openerp purchase report][1] [1]: http://forum.openerp.com/forum/topic8508.htmlcode:
<section>
<para style="terp_default_8">[[ repeatIn(o.order_line,'line') ]][[line_no() ]]</para>
<blockTable colWidths="20.0,100.0,150.0,80.0,50.0,20.0,60.0,50.0" style="Table_Order_Pur_line_Content">
<tr>[[ blank_line(10) ]]<!--[[ setTag('para','para') ]] -->
<td>
<para style="terp_default_9"> </para>
</td>
<td>
<para style="terp_default_9">[[ ', '.join(map(lambda x: x.name, line.taxes_id)) ]]</para>
</td>
<td>
<para style="terp_default_9">[[line.name]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line.product_qty ) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line.price_unit,digits=get_digits(dp='Product Price') ) ]]</para>
</td>
<td>
<para style="terp_default_Right_9"> </para>
</td>
<td>
<para style="terp_default_Right_9"> </para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line.price_subtotal,digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id ) ]] </para>
</td>
</tr>
</blockTable>
[[repeatIn(o.order_line,'o')]]
[[repeatIn(o.order_line, 'o') ]]
<blockTable colWidths="20.0,100.0,150.0,80.0,50.0,20.0,60.0,50.0" style="Table_Order_Pur_line_Content_blank">
<tr>
<td> <para style="terp_default_8"><font color="white"> </font></para></td>
<td> <para style="terp_default_8"><font color="white"> </font></para></td>
<td> <para style="terp_default_8"><font color="white"> </font></para></td>
<td> <para style="terp_default_8"><font color="white"> </font></para></td>
<td> <para style="terp_default_8"><font color="white"> </font></para></td>
<td> <para style="terp_default_8"><font color="white"> </font></para></td>
<td> <para style="terp_default_8"><font color="white"> </font></para></td>
<td> <para style="terp_default_8"><font color="white"> </font></para></td>
</tr>
</blockTable> -->
</section>
推荐答案
在您的报告代码中(假设为order.py)创建一个方法,该方法返回具有适当数量的None元素的列表:
In your report code (let say order.py) create a method returning a list with the appropriate number of None elements :
def _empty_rows(self, n):
return [ None for i in range(n) ]
通过 __ init __ 方法中的 localcontext 字典公开此方法,如下所示:
Expose this method trough the localcontext dictionary in the __init__ method like this:
def __init__(self, cr, uid, name, context):
....
self.localcontext.update( {
'empty_rows': self._empty_rows,
....
})
....
在RML文件(例如order.rml)中使用它来创建所需的行数:
Use it in your RML file (order.rml for ex.) to create the desired number of rows:
[[ repeateIn(empty_rows(10)) ]]
这篇关于如何使用RML代码在表中添加动态空行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!