odoo,如何创建正确的 xpath 表达式
我正在做 odoo 入门教程。我需要创建一个 xpath 表达式。我需要继承 base.view_users_form 视图并添加页面来显示属性列表。 该页面应该位于首选项页面之后,因此我创建了这个表达式。
<record id="inherited_res_user_view_form" model="ir.ui.view">
<field name="name">res.users.extended.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='preferences']" position="after">
<field name="property_ids"/>
</xpath>
</field>
</record>
和错误:
Element '<xpath expr="//page[@name='preferences']">' cannot be located in parent view
所以我知道我的表达不正确,但我不知道它应该是什么。
我也不知道怎么才能查到。我阅读一些关于它是如何工作的,我想我已经足够理解了。但我认为我需要查看 base.view_users_form 的源代码来查找它们如何命名其元素,以便我可以正确使用 xpath。但我也找不到源代码。
I'm doing the odoo getting started tutorial. And I need to create a xpath expression. I need to inherit the base.view_users_form view and add page to display a list of properties.
This page should go after the preferences page, so I created this expresssion.
<record id="inherited_res_user_view_form" model="ir.ui.view">
<field name="name">res.users.extended.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='preferences']" position="after">
<field name="property_ids"/>
</xpath>
</field>
</record>
and the error:
Element '<xpath expr="//page[@name='preferences']">' cannot be located in parent view
So I know my expression is incorrect, but I dont know what it should be.
I also don't know how I can find out. I read a bit about how it works, and I think I understand sufficiently. But I think I need to see the source code of base.view_users_form to find how they name their elements so that I can properly use xpath. But I can't find the source code also.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您仔细查看 view_users_form< /a> 代码,您将看到该页面名为
references
而不是preferences
。尝试以下 XPath:
If you look carefully in the view_users_form code, you will see that the page is named
references
and notpreferences
.Try the following XPath: