ODOO13:QWEB报告HTML和PDF之间的差异

我有一个其他问题无法解决的问题。

我继承了现有的报告(发票)并进行了更改,在HTML中,渲染效果很好,但在PDF渲染中却有所不同。

我已经尝试设置以下设置参数:

  • web.base.url:127.0.0.1:8069或0.0.0.0:8069或其他任何内容。

  • web.base.url.freeze:是

但是所有这些技巧都不起作用。我在HTML中看到的某些行未在PDF中显示。

我在Odoo13和Ubuntu 18.04 Server中工作,并且具有wkhtmltopdf 0.12.5(带有修补的qt)。

您有给我一个神奇的解决方案吗?如果您愿意,我可以更新我的问题以获取更多信息。

非常感谢您。

致谢。

图片:

HTML:https://ibb.co/KDCHHmL

PDF:https://ibb.co/1KfY3ck

更新

<odoo>
    <data>
        <template id="address_custom" inherit_id="web.address_layout">
            <xpath expr="//t[@t-set='colclass']" position="attributes">
                <attribute name="t-value">('col-md-5' if report_type == 'html' else 'col-5')</attribute>
            </xpath>

            <xpath expr="//div[@class='address row']" position="replace">
                <style type="text/css">
                    .certif{
                        font-size: 16px;
                        margin-bottom: 3cm;
                    }

                    .tva{
                        font-size: 14px;
                    }

                    div[name="address"]{
                        margin-top: 20px;
                        font-size: 20px;
                    }

                    #informations,h6{
                        font-size: 15px
                    }

                    .invoice_name{
                        margin-top: 30px;
                    }

                    table,th,td {
                        border: 1.5px solid black;
                    }

                    th,td {
                        padding: 0 10px;
                        text-align: center;
                    }

                    .full-width{
                        width: 100%;
                    }

                    .td50{
                        width: 50px;
                    }

                    .td75{
                        width: 100px;
                    }

                    .td150{
                        width: 200px;
                    }

                    .td350{
                        width: 400px;
                    }

                    .o_standard_footer{
                        margin-top: 20px;
                    }

                    .clearfix{
                        margin-top: 1200px;
                    }

                    td{
                        vertical-align: middle;
                    }
                </style>
                <div class="address row">
                    <div class="col-6">
                        <p class="certif">CERTIFICATION MASE N° RA 2017-200 du 05/07/2017</p>
                        <p class="tva">TVA sur encaissements</p>
                    </div>
                    <div name="address" class="colclass">
                        <t t-raw="address"/>
                    </div>
                </div>
            </xpath>
        </template>


        <template id="report_custom" inherit_id="account.report_invoice_document">
            <xpath expr="//div[@class='page']" position="replace">
                <h6 class="invoice_name">FactURE N° <span t-if="o.name != '/'" t-field="o.name"/></h6>

                <div id="informations" class="row ml4 mb32">
                    <table>
                        <thead>
                            <tr>
                                <th><strong>Code Client</strong></th>
                                <th><strong>Date de Facture</strong></th>
                                <th><strong>Page N°</strong></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td><p class="m-0" t-field="o.partner_id.ref"/></td>
                                <td><p class="m-0" t-field="o.invoice_date"/></td>
                                <td><span class="page"/> / <span class="topage"/></td>
                            </tr>
                        </tbody>
                    </table>
                </div>

                <div class="row">
                    <t t-foreach="o.invoice_line_ids" t-as="line">
                        <div class="col-md-9">
                            <span t-attf-class="{{ 'font-weight-bold' if not line.display_type else '' }}" t-field="line.name"/>
                        </div>
                        <div t-if="not line.display_type" class="col-md-2">
                            <span t-field="line.price_subtotal"/>
                        </div>
                        <div t-if="not line.display_type" class="col-md-1">
                            <t t-foreach="line.tax_ids" t-as="tax">
                                <span t-field="tax.description"/>
                            </t>
                        </div>
                    </t>
                </div>

                <div class="clearfix">
                    <div id="total" class="row">
                        <p class="text-sm-left">"Art.D.441-5 - Le montant de l'indemnité forfaitaire pour frais de
                            recouvrement prévue au douzième alinéa du I de l'article L.441-6 est fixé à 40 euros."</p>
                        <div class="col-md-12">
                            <table class="full-width">
                                <tbody>
                                    <tr>
                                        <td class="td50">
                                            <p>C20</p>
                                        </td>
                                        <td class="td150">
                                            <span t-field="o.amount_untaxed"/>
                                        </td>
                                        <td>

                                        </td>
                                        <td class="td150">
                                            <span t-field="o.amount_untaxed"/>
                                        </td>
                                        <t t-foreach="o.amount_by_group" t-as="amount_by_group">
                                            <t t-if="len(o.line_ids.filtered(lambda line: line.tax_line_id)) == 1 and o.amount_untaxed == amount_by_group[2]">
                                                <td class="td75"><span t-esc="amount_by_group[0]"/></td>
                                                <td class="td150">
                                                    <span t-esc="amount_by_group[3]" />
                                                </td>
                                            </t>
                                        </t>
                                        <td class="td350">
                                            <table class="full-width">
                                                <tbody>
                                                    <tr>
                                                        <td></td>
                                                        <td class="text-right"><span t-field="o.amount_untaxed"/></td>
                                                    </tr>
                                                    <tr>
                                                        <td></td>
                                                        <t t-foreach="o.amount_by_group" t-as="amount_by_group">
                                                            <t t-if="len(o.line_ids.filtered(lambda line: line.tax_line_id)) == 1 and o.amount_untaxed == amount_by_group[2]">
                                                                <td class="text-right">
                                                                    <span t-esc="amount_by_group[3]" />
                                                                </td>
                                                            </t>
                                                        </t>
                                                    </tr>
                                                    <tr>
                                                        <td><br/></td>
                                                        <td><br/></td>
                                                    </tr>
                                                    <tr>
                                                        <td></td>
                                                        <td class="text-right"><span t-field="o.amount_total"/></td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </xpath>
        </template>
    </data>
</odoo>
bjh20091201 回答:ODOO13:QWEB报告HTML和PDF之间的差异

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2933181.html

大家都在问