odoo tree视图默认分组

odoo tree视图默认分组

需求: 以多对一字段关联单号 send_order_id 默认分组

search

<record id="roke_send_customer_search" model="ir.ui.view">
        <field name="name">roke.send.customer.search</field>
        <field name="model">roke.send.customer</field>
        <field name="arch" type="xml">
            <search string="发运单明细">
                <field name="send_order_id"/>
                <field name="send_notice_no"/>
                <group expand="0" string="Group By">
                	<!--分组-->
                    <filter string="运单编号" name="group_by_send_order_id" context="{'group_by':'send_order_id'}"/>
                </group>
            </search>
        </field>
    </record>

action

    <record id="roke_send_customer_action" model="ir.actions.act_window">
        <field name="name">发运单明细</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">roke.send.customer</field>
        <!-- 默认分组 -->
        <field name="context">{'search_default_group_by_send_order_id': 1}</field>
        <field name="view_mode">tree,form</field>
        <field name="search_view_id"  ref="roke_send_customer_search"/>
    </record>

在这里插入图片描述
本人亲测可以,如果有错误欢迎大佬指正

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值