Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 自定义ODOOQWeb视图_Xml_Xpath_Odoo_Odoo 12 - Fatal编程技术网

Xml 自定义ODOOQWeb视图

Xml 自定义ODOOQWeb视图,xml,xpath,odoo,odoo-12,Xml,Xpath,Odoo,Odoo 12,我试图在OdooV12中定制一个视图,添加一些“xpath”表达式内容,但它不起作用 这是需要添加内容的地方。 我将使用下一个代码来继承模板并进行更改 <record id="education_calendar_website_event_template" model="ir.ui.view"> <field name="name">Education calendar website event</field> <

我试图在OdooV12中定制一个视图,添加一些“xpath”表达式内容,但它不起作用

这是需要添加内容的地方。

我将使用下一个代码来继承模板并进行更改

<record id="education_calendar_website_event_template" model="ir.ui.view">
        <field name="name">Education calendar website event</field>
        <field name="inherit_id" ref="website_event.index" />
        <field name="arch" type="xml">
        <xpath expr="/t[1]/t[1]/div[1]/div[1]" position="inside">
            <div id="website_calendar_events" style="display: none;">
                <ul>
                    <t t-foreach="event_ids" t-as="event">
                        <li>
                            <p class="website_event_data" id="e_data_1">
                                <t t-esc="event.id" />
                            </p>
                        </li>
                    </t>
                </ul>
            </div>
        </xpath>
        </field>
    </record>

教育日历网站活动
我也尝试了下一个表达式,但不起作用: -//div[@id='oe\结构\网站\事件\索引\ 1']

有人知道如何继承数据和修改/添加现有模板吗?
谢谢你的阅读

您需要使用
template
标记,并指定要使用
inherit\u id
属性更改的模板id

<template id="event_ids" inherit_id="website_event.index">
    <xpath expr="//div[@id='oe_structure_website_event_index_1']" position="inside">
        <div id="website_calendar_events">
            <ul>
                <t t-foreach="event_ids" t-as="event">
                    <li>
                        <p class="website_event_data" id="e_data_1">
                            <t t-esc="event.id"/>
                        </p>
                    </li>
                </t>
            </ul>
        </div>
    </xpath>
</template>