1

odoo 8 qweb レポートの引用では、xml でカスタム css スタイルを使用しています。

複数の見積書を選択して印刷をクリックすると、以下のようなエラーが表示されます。

  • 一重引用符を印刷すると、すべて問題ありません。
  • xml からカスタム css スタイルを削除すると、すべてが再び機能します。

これが私のモジュールの「view」フォルダーにある元のファイルです。

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="sale_account_report1">
    <!-- Multicompany -->
    <t t-if="o and 'company_id' in o">
        <t t-set="company" t-value="o.company_id"></t>
    </t>
    <t t-if="not o or not 'company_id' in o">
        <t t-set="company" t-value="res_company"></t>
    </t>
    <div class="header">
        <div class="row">
            <div class="col-xs-3">
                <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-height: 45px;"/>
            </div>
        </div>
        <div class="row zero_min_height">
            <div class="col-xs-12">
                <div style="border-bottom: 1px solid black;"></div>
            </div>
        </div>
        <div class="col-xs-5 pull-right">
            <strong><span t-field="o.partner_id.name"/></strong>
            <span t-field="o.partner_id.phone"/>
        </div>
    </div>
    <div class="footer">
        <div class="text-center" style="border-top: 1px solid black;">
            <ul t-if="not company.custom_footer" class="list-inline">
                <li t-if="company.phone">Phone: <span t-field="company.phone"/></li>
                <li t-if="company.fax and company.phone">&amp;bull;</li>
                <li t-if="company.fax">Fax: <span t-field="company.fax"/></li>
                <li t-if="company.email">&amp;bull;</li>
                <li t-if="company.email">Email: <span t-field="company.email"/></li>
                <li t-if="company.website">&amp;bull;</li>
                <li t-if="company.website">Website: <span t-field="company.website"/></li>
            </ul>
            <t t-if="company.custom_footer">
                <span t-raw="company.rml_footer"/>
            </t>
            <ul class="list-inline">
                <li>Page:</li>
                <li><span class="page"/></li>
                <li>/</li>
                <li><span class="topage"/></li>
            </ul>
        </div>
    </div>
    <div class="page">
        <h3 align="center">Sales Order</h3>
        <div class="row mt32 mb32" id="informations">
            <div t-if="o.client_order_ref" class="col-xs-3">
                <strong>Your Reference:</strong>
                <p t-field="o.client_order_ref"/>
            </div>
            <div t-if="o.name" class="col-xs-4">
                <strong t-if="o.state not in ['draft','sent']">Order N°: </strong>
                <strong t-if="o.state in ['draft','sent']">Quotation N°: </strong>
                <p t-field="o.name"/>
            </div>
            <div t-if="o.date_order" class="col-xs-4">
                <strong t-if="o.state not in ['draft','sent']">Date Ordered:</strong>
                <strong t-if="o.state in ['draft','sent']">Quotation Date:</strong>
                <p t-field="o.date_order"/>
            </div>
            <div t-if="o.user_id.name" class="col-xs-4">
                <strong>Total Articles:</strong>
                <div t-esc="get_qty(o.order_line)"/>
            </div>
        </div>

        <table class="table table-condensed">
            <thead>
                <tr>
                    <th>No.</th>
                    <th>Description</th>
                    <th class="text-right">Unit Price</th>
                    <th class="text-right">Quantity</th>
                    <th class="text-right">Total</th>
                </tr>
           </thead>
           <tbody class="sale_tbody">
                <tr t-foreach="o.order_line" t-as="l">
                    <td>
                        <span t-esc="get_no(o.name)"/>
                    </td>
                    <td>
                       <span t-field="l.name"/>
                    </td>
                    <td class="text-right">
                        <span t-field="l.price_unit"/>
                    </td>
                    <td class="text-right">
                        <span t-field="l.product_uom_qty"/>
                        <span groups="product.group_uom" t-field="l.product_uom"/>
                    </td>
                    <td class="text-right">
                        <span t-field="l.price_subtotal"
                            t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
                    </td>
                </tr>
            </tbody>
        </table>

        <div class="row">
            <div class="col-xs-4 pull-right">
                <table class="table table-condensed">
                    <tr class="border-black">
                        <td><strong>Total</strong></td>
                        <td class="text-right">
                            <span t-field="o.amount_untaxed"
                                t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
                        </td>
                    </tr>
                    <tr>
                        <td>Taxes</td>
                        <td class="text-right">
                            <span t-field="o.amount_tax"
                                t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
                        </td>
                    </tr>
                    <tr class="border-black">
                        <td><strong>This Invoice Total</strong></td>
                        <td class="text-right">
                            <span t-field="o.amount_total"
                                t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
                        </td>
                    </tr>
                    <tr t-if="o.state in ['draft','sent']" class="border-black">
                        <td><strong>Overdue Payment</strong></td>
                        <td class="text-right">
                            <span t-field="o.partner_id.credit"
                                t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
                        </td>
                    </tr>
                    <tr t-if="o.state in ['draft','sent']" class="border-black">
                        <td><strong>Total Amount Due</strong></td>
                        <td class="text-right">
                            <span t-raw='o.amount_total + o.partner_id.credit'
                                t-raw-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
                        </td>
                    </tr>
                </table>
            </div>
        </div>

        <p t-field="o.note" />
        <p t-if="o.payment_term">
            <strong>Payment Term:</strong>
            <span t-field="o.payment_term"/>
        </p>
        <div class="oe_structure"/>
    </div>
</template>

<template id="sale_account_report.report_saleorder_custom">
    <t t-call="report.html_container">
        <t t-foreach="doc_ids" t-as="doc_id">
            <t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'sale_account_report.sale_account_report1')"/>
        </t>
    </t>
</template>
</data>
</openerp>

元のファイルを使用すると、すべて正常に動作しますが、次のようなファイルのどこかに以下のスタイルを入れると

<div  style="font:18px 'Jameel Noori Nastaleeq', 'Nafees Web Naskh' !important;">

複数の見積を選択すると、以下のエラーが表示されます。このスタイルを削除してモジュールを更新すると、すべて正常に動作します。私を助けてください。

Traceback (most recent call last):   File "/opt/odoo/odoo/addons/report/controllers/main.py", line 121, in report_download
    response = self.report_routes(reportname, docids=docids, converter='pdf')   File "/opt/odoo/odoo/openerp/http.py", line 388, in response_wrap
    response = f(*args, **kw)   File "/opt/odoo/odoo/addons/report/controllers/main.py", line 65, in report_routes
    pdf = report_obj.get_pdf(cr, uid, docids, reportname, data=options_data, context=context)   File "/opt/odoo/odoo/openerp/api.py", line 237, in wrapper
    return old_api(self, *args, **kwargs)   File "/opt/odoo/odoo/addons/report/models/report.py", line 269, in get_pdf
    paperformat, specific_paperformat_args, save_in_attachment   File "/opt/odoo/odoo/openerp/api.py", line 237, in wrapper
    return old_api(self, *args, **kwargs)   File "/opt/odoo/odoo/addons/report/models/report.py", line 480, in
_run_wkhtmltopdf
    entire_report_path = self._merge_pdf(pdfdocuments)   File "/opt/odoo/odoo/addons/report/models/report.py", line 569, in
_merge_pdf
    writer.write(merged_file)   File "/usr/lib/pymodules/python2.7/pyPdf/pdf.py", line 264, in write
    self._sweepIndirectReferences(externalReferenceMap, self._root)   File "/usr/lib/pymodules/python2.7/pyPdf/pdf.py", line 339, in
_sweepIndirectReferences
    self._sweepIndirectReferences(externMap, realdata)   File "/usr/lib/pymodules/python2.7/pyPdf/pdf.py", line 315, in
_sweepIndirectReferences
    value = self._sweepIndirectReferences(externMap, value)   File "/usr/lib/pymodules/python2.7/pyPdf/pdf.py", line 339, in
_sweepIndirectReferences
    self._sweepIndirectReferences(externMap, realdata)   File "/usr/lib/pymodules/python2.7/pyPdf/pdf.py", line 315, in
_sweepIndirectReferences
    value = self._sweepIndirectReferences(externMap, value)   File "/usr/lib/pymodules/python2.7/pyPdf/pdf.py", line 324, in
_sweepIndirectReferences
    value = self._sweepIndirectReferences(externMap, data[i])   File "/usr/lib/pymodules/python2.7/pyPdf/pdf.py", line 339, in
_sweepIndirectReferences
    self._sweepIndirectReferences(externMap, realdata)   File "/usr/lib/pymodules/python2.7/pyPdf/pdf.py", line 315, in
_sweepIndirectReferences
    value = self._sweepIndirectReferences(externMap, value)   File "/usr/lib/pymodules/python2.7/pyPdf/pdf.py", line 354, in
_sweepIndirectReferences
    newobj = self._sweepIndirectReferences(externMap, newobj)   File "/usr/lib/pymodules/python2.7/pyPdf/pdf.py", line 315, in
_sweepIndirectReferences
    value = self._sweepIndirectReferences(externMap, value)   File "/usr/lib/pymodules/python2.7/pyPdf/pdf.py", line 315, in
_sweepIndirectReferences
    value = self._sweepIndirectReferences(externMap, value)   File "/usr/lib/pymodules/python2.7/pyPdf/pdf.py", line 345, in
_sweepIndirectReferences
    newobj = data.pdf.getObject(data)   File "/usr/lib/pymodules/python2.7/pyPdf/pdf.py", line 649, in getObject
    retval = readObject(self.stream, self)   File "/usr/lib/pymodules/python2.7/pyPdf/generic.py", line 67, in readObject
    return DictionaryObject.readFromStream(stream, pdf)   File "/usr/lib/pymodules/python2.7/pyPdf/generic.py", line 519, in readFromStream
    key = readObject(stream, pdf)   File "/usr/lib/pymodules/python2.7/pyPdf/generic.py", line 87, in readObject
    return NumberObject.readFromStream(stream)   File "/usr/lib/pymodules/python2.7/pyPdf/generic.py", line 227, in readFromStream
    return NumberObject(name) ValueError: invalid literal for int() with base 10: ''
4

0 に答える 0