Xml Odoo11QWeb报告:xpath标记;替换“;不替换
Xml Odoo11QWeb报告:xpath标记;替换“;不替换,xml,xpath,odoo,qweb,odoo-11,Xml,Xpath,Odoo,Qweb,Odoo 11,我正在尝试自定义Odoo 11中的发票报告。 问题是,xpath标记“replace”不能正常工作。说,我引用: “[替换:]继承规范的内容替换匹配的节点。规范内容中仅包含$0的任何文本节点将替换为匹配节点的完整副本,从而有效地包装匹配节点”。 现在,我需要完全替换invoice PDF报表中的发票行,因此我尝试完全替换表标记: <template id="invoice_gross_amount_document" inherit_id="account.repor
我正在尝试自定义Odoo 11中的发票报告。
问题是,xpath标记“replace”不能正常工作。说,我引用:
“[替换:]继承规范的内容替换匹配的节点。规范内容中仅包含$0的任何文本节点将替换为匹配节点的完整副本,从而有效地包装匹配节点”。
现在,我需要完全替换invoice PDF报表中的发票行,因此我尝试完全替换表标记:
<template id="invoice_gross_amount_document"
inherit_id="account.report_invoice_document">
<xpath expr="//div/table[@name='invoice_line_table']"
position="replace">
<p>TEST</p>
</xpath>
</template>
试验
这将删除该表,并用简单的字符串“Test”替换它。
但是-很抱歉,我很想直接上传图片,但我的代表性较低,所以链接不够:(
为什么会发生这种情况?我怎样才能成功地完全替换节点?有人能帮我吗?试试这段代码
<template id="invoice_gross_amount_document" inherit_id="account.report_invoice_document">
<xpath expr="//div[@class='page']//table[@class='table table-condensed']" position="replace">
<h1>TEST</h1>
</xpath>
</template>
试验
**Odoo 11 QWeb报告:xpath标记“替换”未替换**
你能告诉我你换桌子的时候有什么错误吗?
我使用了下面的代码并继承了发票报告。
试验
然后得到你能在我的图像中看到的输出。
[1]: https://i.stack.imgur.com/OZK4h.png
在/table
之前删除'div'标记,然后再次运行。@KevalMehta它不工作,继续添加“TEST”,而不删除表本身。我没有收到任何错误,回溯是完全干净的,但替换返回的报告可以在我上面链接的图像中看到:(哦…所以我认为您的数据库中有任何自定义模块,可以为您提供此发票行表。所以请检查是否有好运…)。。。。
**Odoo 11 QWeb Report: xpath tag “replace” not replacing**
Can you please tell me what error you got while replace the table?
I used below code and inherit the invoice report.
<odoo>
<data>
<template id="invoice_gross_amount_document" inherit_id="account.report_invoice_document">
<xpath expr="//table[@name='invoice_line_table']" position="replace">
<h1>TEST</h1>
</xpath>
</template>
</data>
</odoo>
And get the output that you can see in my Image.
[1]: https://i.stack.imgur.com/OZK4h.png