为什么会出现此错误?
ValueError:元素“不能为 位于父视图中
错误上下文:视图
Add custom forecasted quantities
[view_id:2030年, xml_id:Forecasted_qty.forecasted_qty_product_template_only_form_view, 型号:product.template,parent_id:362]
(-) 待售数量
<record model="ir.ui.view" id="forecasted_qty_product_normal_form_view">
<field name="name">Add custom forecasted quantities</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="model">product.product</field>
<field name="priority">99</field>
<field name="arch" type="xml">
<xpath expr="//button[@name='%(stock.action_stock_level_forecast_report_product)d']" position="before">
<button name="do_nothing" type="object" attrs="{'invisible':[('type', '!=', 'product')]}"
class="oe_stat_button" icon="fa-building-o">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value"><field name="forecasted_qty" widget="statinfo" nolabel="1"/>
<span attrs="{'invisible':[('outgoing_qty', '=', 0),('incoming_qty','=',0)]}">
(-<field name="outgoing_qty" widget="statinfo" nolabel="1"/>)
</span>
</span>
<span class="o_stat_text">Qty for Sale</span>
</div>
</button>
</xpath>
</field>
</record>
答案 0 :(得分:1)
用法如下:
<xpath expr="//header/button[279]" pposition="before">