Pri*_*ngd 3 python xml openerp
我把ssnid和sinid设置为隐形字段.但在我看来,两者仍然是显示.看似XPath位置的问题.
任何人都可以帮我解决?
<?xml version="1.0"?>
<openerp>
<data>
<!-- 1st part of the sim_view start -->
<record model="ir.ui.view" id="madulsima_plucker_form">
<field name="name">madulsima.plucker.form</field>
<field name="model">madulsima.plucker</field>
<field name="inherit_id" ref="hr.view_employee_form" />
<field name="type">form</field>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Madulsima Plucker Fields">
<field name="reg_no" />
<field name="worker_name" />
<xpath expr="/form/notebook/page/group/field[@name='ssnid']"
position="attributes">
<attribute name="invisible">True</attribute>
</xpath>
<xpath expr="/form/notebook/page/group/field[@name='sinid']"
position="attributes">
<attribute name="invisible">True</attribute>
</xpath>
</page>
</notebook>
</field>
</record>
<record model="ir.actions.act_window" id="action_plucker_registration">
<field name="name">Plucker Registration</field>
<field name="res_model">madulsima.plucker</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
</record>
<menuitem id="menu_madulsima_plucker" name="Madulsima/Checkroll" />
<menuitem id="menu_madulsima_plucker_registration" name="Plucker Registration"
parent="menu_madulsima_plucker" action="action_plucker_registration" />
</data>
</openerp>
Run Code Online (Sandbox Code Playgroud)
我在view.xml中发布了我的整个代码
继承视图的arch字段中的根元素是定位器,它们应该标识父视图中的元素,然后可以根据特殊属性执行操作.position
定位器必须具有position属性,并且可以是:
<xpath>的expr属性
的元素,用于在父视图中定位单个元素;继承的视图可以有多个根元素,以便对父视图执行多次更改.
您的示例不正确,因为您嵌套了多个定位器:您的xpath元素位于元素内部page.请注意,3个元素position在继承的视图中具有属性:notebook元素和2个xpath元素.它们都需要位于视图架构的顶部,例如:
<field name="arch" type="xml">
<notebook position="inside">
<!-- ... elements you want to add inside the parent notebook -->
</notebook>
<xpath expr="/form/notebook/page/group/field[@name='ssnid']"
position="attributes">
<attribute name="invisible">True</attribute>
</xpath>
<xpath expr="/form/notebook/page/group/field[@name='sinid']"
position="attributes">
<attribute name="invisible">True</attribute>
</xpath>
</field>
Run Code Online (Sandbox Code Playgroud)
PS:如果你不熟悉XPath,你应该在网上寻找快速参考或备忘单,比如这个.
| 归档时间: |
|
| 查看次数: |
5620 次 |
| 最近记录: |