• 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


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

  • 相关阅读:
    【原创】开源Math.NET基础数学类库使用(01)综合介绍
    【原创】开源.NET排列组合组件KwCombinatorics使用(三)——笛卡尔积组合
    【原创】开源.NET排列组合组件KwCombinatorics使用(二)——排列生成
    apply,call,bind的区别
    javascript替换手机号中间4位
    css常见的概念
    关于URL编码/javascript/js url 编码
    jquery判断div滚动条到底部
    javascript中的array对象属性及方法
    localStorage和sessionStorage区别
  • 原文地址:https://www.cnblogs.com/qianxunman/p/15399138.html
Copyright © 2020-2023  润新知