zoukankan      html  css  js  c++  java
  • odoo 报表打印多条记录换页与不换页设置

    主要看web.basic_layout是在foreach 之前还是之后

    1. basic_layout 在foreach 之前,没有换页
    <template id="product_item_label">
            <t t-call="web.html_container">
                <t t-call="web.basic_layout">
    
                <t t-foreach="docs" t-as="doc">
                        <div class="page">
                            <t t-set="product" t-value="doc"/>
                            <t t-if="product.barcode">
                                <img alt="Barcode" t-if="len(product.barcode) == 13" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN13', product.barcode, 600, 150)" style="100%;height:4rem;" />
                                <img alt="Barcode" t-elif="len(product.barcode) == 8" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN8', product.barcode, 600, 150)" style="100%;height:4rem;" />
                                <img alt="Barcode" t-else="" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', product.barcode, 600, 150)" style="100%;height:4rem" />
                                <span t-field="product.barcode" />
                            </t>
                            <t t-else="">
                                <span class="text-muted">No barcode available</span>
                            </t>
                        </div>
                    </t>
                </t>
            </t>
        </template>
    

    image

    1. base_layout 在foreach 里边,则每条记录至少占用一页.
        <template id="product_item_label">
            <t t-call="web.html_container">
    
                <t t-foreach="docs" t-as="doc">
                <t t-call="web.basic_layout">
    
                        <div class="page">
                            <t t-set="product" t-value="doc"/>
                            <t t-if="product.barcode">
                                <img alt="Barcode" t-if="len(product.barcode) == 13" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN13', product.barcode, 600, 150)" style="100%;height:4rem;" />
                                <img alt="Barcode" t-elif="len(product.barcode) == 8" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN8', product.barcode, 600, 150)" style="100%;height:4rem;" />
                                <img alt="Barcode" t-else="" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', product.barcode, 600, 150)" style="100%;height:4rem" />
                                <span t-field="product.barcode" />
                            </t>
                            <t t-else="">
                                <span class="text-muted">No barcode available</span>
                            </t>
                        </div>
                    </t>
                </t>
            </t>
        </template>
    

    image


    懂得,原来世界如此简单!

  • 相关阅读:
    js动态生成按钮,页面用DIV简单布局
    Maven初学之经验浅谈
    pl/sql注册码
    windows server 2012R2 网络慢的那些事
    sql 优化
    巧用selectKey
    list集合,map集合遍历
    oracle中declare程序块用法
    处理oracle锁表
    关于img标签图片不加载不识别相对路径得解决办法
  • 原文地址:https://www.cnblogs.com/qianxunman/p/15399138.html
Copyright © 2011-2022 走看看