Inventory 中默认的树视图

Tree view by default in Inventory

在 Sales 中,当我转到“产品”菜单时,默认情况下会显示树视图。 我是这样做的

<record id="product.product_normal_action_sell" model="ir.actions.act_window">
            <field name="view_mode">tree,form,kanban</field>
        </record>
        <record id="product.product_template_action" model="ir.actions.act_window">
            <field name="view_mode">tree,form,kanban</field>
            <field name="view_id" ref="product.product_template_tree_view"/>
        </record>

在采购和制造中相同,但我在库存中做同样的事情时遇到问题。

这是调用动作的原创菜单

<menuitem
            action="product.product_template_action_product" id="menu_product_variant_config_stock" name="Products"
            parent="stock.menu_stock_inventory_control" sequence="1"/>

我怎样才能做到当我进入库存->产品树视图时默认打开

其实都是一样的。你需要添加

  <record id="product.product_template_action_product" model="ir.actions.act_window">
            <field name="view_mode">tree,form,kanban</field>
        </record>

进入产品视图