简体   繁体   English

Odoo 10自定义Qweb报告页面设计

[英]Odoo 10 custom Qweb report page design

I've created my custom report and which has more than 1 page. 我已经创建了自定义报告,该报告有1页以上。 You can imagine that each page has a table. 您可以想象每个页面都有一个表格。 And table can have 10 row in a page, if rows are more than 10, rows go second page. 并且表格在一页中可以有10行,如果行超过10,则行进入第二页。 By the way, other table slides to half of page. 顺便说一句,其他表格滑到页面的一半。 But I want to all tables should start the top of the page in any case. 但是我希望所有表无论如何都应该从页面顶部开始。 If there is 14 row in the first table, the second table must start the third page. 如果第一个表中有14行,则第二个表必须从第三页开始。 I wrote a condition in python like; 我用python这样写了一个条件:

extrapage = fields.Boolean(compute="function") 
def function():
if row >=10:
    extrapage = True

and view.xml 和view.xml

<t
t-if="o.extrapage"
<div style="height:29cm;width:20cm;"></div>
</t>

but i dont want to make like this, must be some professional way. 但是我不想这样,必须是一些专业的方法。 Can you help me to do? 你能帮我做吗? Thank you. 谢谢。

Please follow and use the below code in the Qweb Template View 请遵循并在Qweb模板视图中使用以下代码

Let assume that o is your purchase order and I will try to break the page when my purchase order line having more than 10 records. 假设o是您的采购订单,并且当我的采购订单行中有10条以上的记录时,我将尝试分页显示。

<tr t-foreach="o.order_line" t-as="line">

    <t t-if="line_index+1 == 10">
        <p style="page-break-after:always;"/>
    </t>
</tr>

Attributes : 属性:

=> o : purchase order object => o:采购订单对象

=> order_line : is the purchase order line => order_line:是采购订单行

=> _index : its special attribute in the qweb template which is help to count the interaction record inside line object. => _index:它在qweb模板中的特殊属性,有助于统计线对象内的交互记录。

I hope my answer may helpful for you :) 希望我的回答对您有所帮助:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM