我试图将在Odoo 8上完成的继承模板用于刚刚迁移的Odoo 10数据库。出乎意料的是,标题消失了,并且也没有样式。我已经检查了日志并进行了一些更改,但是看不到PDF的页眉,页脚或样式,但是,如果我以HTML格式“打印”,我会看到。
我还有其他用于外部布局的内容:
<template id="dentaltix_report_layout_styles" inherit_id="report.assets_editor">
<xpath expr="." position="inside">
<link rel="stylesheet" type="text/css" href="/dentaltix_core_changes/static/src/css/dentaltix_report.css"/>
</xpath>
</template>
<template id="dentaltix_external_layout_header" inherit_id="report.external_layout_header">
<xpath expr="//div[@class='header']/div[@class='row'][2]/div[@class='col-xs-6']" position="replace">
<div class="col-xs-6">
<div t-field="company.partner_id"
t-field-options='{"widget": "contact", "fields": ["name"], "no_marker": True}' />
<div t-if="company.partner_id.vat">TIN: <span t-field="company.partner_id.vat"/></div>
<div t-field="company.partner_id"
t-field-options='{"widget": "contact", "fields": ["address"], "no_marker": True}' />
</div>
<div class="col-xs-6 text-right">
<div t-field="company.partner_id"
t-field-options='{"widget": "contact", "fields": ["phone","email"], "no_marker": False}' />
</div>
</xpath>
</template>
以及report_saleorder_document模板的以下内容:
<template id="report_saleorder_document_ext" inherit_id="sale.report_saleorder_document">
<xpath expr="//div[@class='page']/div[@class='row'][1]" position="replace">
<div class="col-xs-12">
<h6><strong>Invoice and shipping address:</strong></h6>
<div class="row">
<div class="col-xs-5 col-xs-offset-1">
<div t-if="doc.partner_id.parent_id and doc.partner_id.parent_id.id > 0"><span t-field="doc.partner_id.parent_id.name"/></div>
<div t-if="not doc.partner_id.parent_id"><span t-field="doc.partner_id.name"/></div>
<div t-if="doc.partner_id.vat">VAT: <span t-field="doc.partner_id.vat"/></div>
<div t-field="doc.partner_id" t-options='{"widget": "contact", "fields": ["address", "phone", "email"], "no_marker": False, "phone_icons": True}'/>
</div>
<div class="col-xs-5 col-xs-offset-1">
<div t-field="doc.ship_addr_name"/>
<div>
<div t-field="doc.ship_addr_street"/>
<div>
<span t-field="doc.ship_addr_zip"/>
<span t-field="doc.ship_addr_city"/>,
<span t-field="doc.ship_addr_state"/>.
</div>
<span t-field="doc.ship_addr_country"/>
</div>
<div t-field="doc.ship_addr_phone"/>
<div t-field="doc.ship_addr_extra_info"/>
</div>
</div>
</div>
</xpath>
<xpath expr="//div[@id='informations']/div[3]" position="replace"/>
<xpath expr="//div[@class='page']/h2" position="replace">
<div class="row">
<div class="col-xs-12">
<h4><strong>
<span t-if="doc.state not in ['draft','sent']">Order N° </span>
<span t-if="doc.state in ['draft','sent']">Quotation N° </span>
<span t-field="doc.name"/>
</strong></h4>
</div>
</div>
</xpath>
<xpath expr="//div[@class='page']/t[2]/table" position="replace">
<table class="table table-condensed">
<thead>
<tr>
<th class="text-center">Reference</th>
<th class="text-center">Description</th>
<th class="text-center">Taxes</th>
<th class="text-center">Quantity</th>
<th class="text-center">Unit Price</th>
<th class="text-center">Discount (%)</th>
<th class="text-center">Price</th>
</tr>
</thead>
<tbody class="sale_tbody">
<tr t-foreach="doc.order_line" t-as="l">
<td><span t-field="l.product_id.default_code"/></td>
<td><span t-field="l.name"/></td>
<td><span t-esc="', '.join(map(lambda x: x.name, l.tax_id))"/></td>
<td class="text-right">
<span t-esc="l.product_uom_qty"/>
<span groups="product.group_uom" t-field="l.product_uom"/> ut.
</td>
<td class="text-right">
<span t-field="l.price_unit"
t-field-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
</td>
<td class="text-right"><span t-esc="l.discount"/>%</td>
<td class="text-right">
<span t-field="l.price_subtotal"
t-field-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
</td>
</tr>
</tbody>
</table>
</xpath>
<xpath expr="//div[@class='page']/div[@class='oe_structure'][2]" position="before">
<div t-if="doc.payment_method and doc.payment_method == 'bank_transfer' and doc.payment_method != ''" id="payment_method_note" class="row" style="font-size: 10px;">
<div class="col-xs-12">
<h6><strong>Payment method:</strong></h6>
<div t-field="doc.ship_addr_phone"/>
<p><strong>
To process this order is necessary you pay the total amount <br/>
making a transfer to the next bank account number:
</strong></p>
<div t-foreach="doc.company_id.partner_id.bank_ids" t-as="b">
<span>Account owner:</span> <span t-field="b.partner_id.name"/><br/>
<span t-field="b.acc_country_id"/>: <span t-field="b.acc_number"/><br/>
<span>BIC / SWIFT Code:</span> <span t-field="b.bank_bic"/><br/>
<span>Bank:</span> <span t-field="b.bank_name"/><br/>
</div>
</div>
</div>
</xpath>
</template>
<template id="report_saleorder_ext">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="doc">
<t t-call="sale.report_saleorder_document" t-lang="doc.partner_id.lang"/>
</t>
</t>
</template>
我正在失去其他变化吗?
自定义标头是通过Odoo 8设置视图设置的,它曾经可以正常工作。如果您需要它,请告诉我,我粘贴在这里。
答案 0 :(得分:1)
这是一个reported bug,但是由于未知的原因,它第一次对我不起作用。我又做了一次,并且有效。
它无法正常工作的可能原因:
report.url
参数必须在odoo.conf中指定了端口(默认值:8069)。 report.url
合作(成功)。