如何在odoo中添加qweb-pdf页面的边框?

时间:2015-11-30 09:30:44

标签: python xml openerp

我有以下代码用于qweb-pdf报告其工作正常,但我想在我的页面添加完整的边框

    <?xml version="1.0" encoding="utf-8"?>
    <openerp>
    <data>
    <template id="report_feedback">

        <t t-call="report.html_container">
            <t t-foreach="docs" t-as="o">
                <t t-call="report.external_layout">
                    <div class="page">
                        <h2>Feedback Report</h2>

                        <div class="row mt32 mb32">
                            <div class="col-xs-3" style="float:center;">
                    <strong>Substation:</strong>
                                <p t-field="o.company_id111.name"/>
                    <!--<strong>Maintainace ID:</strong>
                                <p t-field="o.folionum.number"/>
                                <strong>Folionum:</strong>
                                <p t-field="o.folio_number.folio_num"/>
                    <strong>Inspection Type :</strong>
                                <p t-field="o.inspec_type.inspection_name"/>-->

                            </div>
                        </div>
              <!--  <div class="row mt64 mb64">
                            <div class="col-xs-6">

                            </div>
                        </div>-->

                       <div style="float:center">

                        <table border="1" class="table table-condensed" style="border-style:solid">
                            <thead>
                                <tr>
                                    <th style="border: 1px solid black" class="text-center">Maintenance ID </th>
                    <th style="border: 1px solid black" class="text-center">Folio number </th>
                    <th style="border: 1px solid black" class="text-center">Inspection Type </th>
                    <th style="border: 1px solid black" class="text-center">Result </th>
                    <th style="border: 1px solid black" class="text-center">Values/Results </th>





                                </tr>
                            </thead>
                            <tbody>
                                <tr t-foreach="o.insp_rslt" t-as="line"><td style="border: 1px solid black"><span t-field="line.folionum.number"/></td>
                    <td style="border: 1px solid black"><span t-field="line.folio_number.folio_num"/></td>
                    <td style="border: 1px solid black"><span t-field="line.inspec_type.inspection_name"/></td>
                    <td style="border: 1px solid black"><span t-field="line.insp_msr1.measure"/></td>
                    <td style="border: 1px solid black"><span t-field="line.valuess"/></td>
    </tr>

                            </tbody>
                        </table>
            </div>
                    </div>
                </t>
            </t>
        </t>
    </template>
    </data>
    </openerp>

feedback_report xml。我也试过了report.paperformat但是我无法在页面上添加边框。

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <report
            id="action_report_feedback"
            string="Feedback Report"
            model="feedback.form"
            report_type="qweb-pdf"
            name="feedback_form.report_feedback"
            file="feedback_form.report_feedback"
        />

    <record id="paperformat_lowmargin" model="report.paperformat">
        <field name="name">European A4 low margin</field>
        <field name="default" eval="True" />
        <field name="format">A4</field>
        <field name="page_height">0</field>
        <field name="page_width">0</field>
        <field name="orientation">Portrait</field>
        <field name="margin_top">4</field>
        <field name="margin_bottom">4</field>
        <field name="margin_left">4</field>
        <field name="margin_right">4</field>
        <field name="header_line" eval="False" />
        <field name="header_spacing">4</field>
        <field name="dpi">90</field>
    </record>

<record id="feedback_form.action_report_feedback" model="ir.actions.report.xml">
    <field name="paperformat_id" ref="feedback_form.paperformat_lowmargin" />
</record>

2 个答案:

答案 0 :(得分:1)

你需要在报告模块中的layouts.xml文件中使用带有div标签的border,就像这个外页类一样

<div style="border: 1px solid black;">
     <div class = "page"></div>
</div>

答案 1 :(得分:0)

<table class="table table-bordered">

您可以为页面类添加您的客户css。

<div class="page">