可以在xml中添加节点属性create="1"
<record id="move_reserved_view_form" model="ir.ui.view">
<field name="name">move.reserved.view.form</field>
<field name="model">move.reserved</field>
<field name="arch" type="xml">
<form string="">
<sheet>
<group>
<!-- Add your fields here -->
<field name="product_id"/>
<field name="move_id"/>
<!-- <field name="quants" readonly="0"/> -->
<field name="quants" domain="[('product_id','=',product_id)]"
context="{'search_default_internal_loc':1}">
<tree create="1">
<!--如果不添加create属性,就不能添加数据.-->
<control>
<create string="添加明细"/>
</control>
<!-- <field name="id"/> -->
<field name="product_id"/>
<field name="quantity"/>
<field name="reserved_quantity"/>
<field name="product_color"/>
<field name="product_level"/>
</tree>
</field>
</group>
</sheet>
<footer>
<button name="write_back_package" string="确定库存信息" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
懂得,原来世界如此简单!