gpt4 book ai didi

python - 继承的 xpath 未显示 - Odoo v8

转载 作者:太空宇宙 更新时间:2023-11-03 15:08:14 24 4
gpt4 key购买 nike

我正在继承 View mrp_workorder_variation.mrp_production_workcenter_form_view_inherit_2并添加一个新页面,但没有显示,我不知道为什么,这是我的代码:

  <record id="mrp_production_workcenter_form_view_inherit_3" model="ir.ui.view">
<field name="name">MRP Production Work Book Block</field>
<field name="model">book.block.code</field>
<field name="inherit_id" ref="mrp_workorder_variation.mrp_production_workcenter_form_view_inherit_2"/>
<field name="arch" type="xml">

<xpath expr="//page[@string='Input/Output Products']" position="after">
<page string="Book Block">
<group>
<group string="Book Block">
<field name="name"/>
<field name="description"/>
</group>
</group>
</page>
</xpath>

</field>
</record>

这是我继承的原始 View :

 <record id="mrp_production_workcenter_form_view_inherit_2" model="ir.ui.view">
<field name="name">MRP Production Workcenter Line</field>
<field name="model">mrp.production.workcenter.line</field>
<field name="inherit_id" ref="mrp_operations.mrp_production_workcenter_form_view_inherit"/>
<field name="arch" type="xml">

<xpath expr="//page[@string='Information']" position="after">
<page string="Input/Output Products">
<group>
<group string="Input Products">
<field name="mrp_workorder_variation_line_ids" nolabel="1"
attrs="{'readonly': [('state','!=','draft')]}">
<tree string="Input Product" editable="bottom">
<field name="product_id"
on_change="on_change_product_uom(product_id)"/>
<field name="product_uom"/>
<field name="product_qty"/>
</tree>
<form string="Input Product" version="7.0">
<field name="product_id"/>
<field name="product_uom"/>
<field name="product_qty"/>
</form>
</field>
</group>
</group>
<group>
<group string="Output Products">
<field name="mrp_workorder_variation_output_line_ids" nolabel="1"
attrs="{'readonly': [('state','!=','startworking')]}">
<tree string="Output Product" editable="bottom">
<field name="product_id"
on_change="on_change_product_uom(product_id)"/>
<field name="product_uom"/>
<field name="product_qty"/>
</tree>
<form string="Output Product" version="7.0">
<field name="product_id" />
<field name="product_uom"/>
<field name="product_qty"/>
</form>
</field>
</group>
</group>

</page>
</xpath>

</field>
</record>

关于为什么会发生这种情况有什么想法吗?

我也尝试继承原来的<xpath expr="//page[@string='Information']"但结果相同,没有显示新页面。

提前致谢!

编辑

如果我把它改成这样:

`<record id="mrp_production_workcenter_form_view_inherit_3" model="ir.ui.view">
<field name="name">MRP Production Work Book Block</field>
<field name="model">book.block.code</field>
<field name="inherit_id" ref="mrp_operations.mrp_production_workcenter_form_view_inherit"/>
<field name="arch" type="xml">

<xpath expr="//page[@string='Information']" position="after">
<page string="Book Block">
<group>
<group string="Book Block">
<field name="name"/>
<field name="description"/>
</group>
</group>
</page>
</xpath>

</field>
</record>`

这是原来的模块,仍然没有显示新页面

最佳答案

我认为您不允许通过字符串属性选择页面。不知道为什么。我认为您可以使用命名页面。

尝试在页码//page[first()] 或//page[last()] 上选择,我很确定您也可以在第 n 页上选择。

您还可以尝试完全覆盖他们的 View ,并将您的页面包含在他们已经使用的 xpath 中。在这种情况下,本质上是完全复制它们的 View 并命名 xml id。

 <record id="addon_namespacehere.mrp_production_workcenter_form_view_inherit_2" model="ir.ui.view">
<field name="name">MRP Production Workcenter Line</field>
<field name="model">mrp.production.workcenter.line</field>
<field name="inherit_id" ref="mrp_operations.mrp_production_workcenter_form_view_inherit"/>
<field name="arch" type="xml">

<xpath expr="//page[@string='Information']" position="after">
<page string="Input/Output Products">
<group>
<group string="Input Products">
<field name="mrp_workorder_variation_line_ids" nolabel="1"
attrs="{'readonly': [('state','!=','draft')]}">
<tree string="Input Product" editable="bottom">
<field name="product_id"
on_change="on_change_product_uom(product_id)"/>
<field name="product_uom"/>
<field name="product_qty"/>
</tree>
<form string="Input Product" version="7.0">
<field name="product_id"/>
<field name="product_uom"/>
<field name="product_qty"/>
</form>
</field>
</group>
</group>
<group>
<group string="Output Products">
<field name="mrp_workorder_variation_output_line_ids" nolabel="1"
attrs="{'readonly': [('state','!=','startworking')]}">
<tree string="Output Product" editable="bottom">
<field name="product_id"
on_change="on_change_product_uom(product_id)"/>
<field name="product_uom"/>
<field name="product_qty"/>
</tree>
<form string="Output Product" version="7.0">
<field name="product_id" />
<field name="product_uom"/>
<field name="product_qty"/>
</form>
</field>
</group>
</group>

</page>
<page string="Book Block">
<group>
<group string="Book Block">
<field name="name"/>
<field name="description"/>
</group>
</group>
</page>
</xpath>

</field>
</record>

关于python - 继承的 xpath 未显示 - Odoo v8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44449113/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com