可以在xml中添加节点属性create="1"

    <record >
        <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>

相关文章:

  • 2021-11-10
  • 2021-11-06
  • 2022-12-23
  • 2021-07-17
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
猜你喜欢
  • 2021-10-24
  • 2021-10-25
  • 2021-10-31
  • 2021-05-28
  • 2021-08-05
  • 2021-07-06
  • 2022-12-23
相关资源
相似解决方案