按字段名

时间:2017-06-06 13:40:30

标签: openerp odoo-8 odoo-9

我想按城市分组,但这种可能性并没有显示出来。我的错在哪里? python文件中有字段城市,它在树视图中显示,但实际上不在Group by

<openerp>
    <data>

    <record id="vpicktree" model="ir.ui.view">
            <field name="name">Picking tree city</field>
            <field name="model">stock.picking</field>
            <field name="inherit_id" ref="stock.vpicktree"/>
            <field name="arch" type="xml">
                <field name="location_dest_id" position="after">
                    <field name="city"/>
                </field>
            </field>
        </record>

       <record model="ir.ui.view" id="stock_picking_filter_city_search">
            <field name="name">stock.picking.tree.filter_search</field>
            <field name="model">stock.picking</field>
            <field name="arch" type="xml">
                <search string="City">
                    <filter name="city" string="City" context="{'group_by':'city'}"/>
                 </search>
             </field>
       </record>

        <record id="action_picking_tree_city" model="ir.actions.act_window">
            <field name="name">City</field>
            <field name="res_model">stock.picking</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,kanban,calendar</field>
            <field name="domain"></field>
            <field name="context">{ 'group_by':'city' }</field>
            <field name="search_view_id" ref="stock.view_picking_internal_search"/>
        </record>
    </data>
</openerp>

1 个答案:

答案 0 :(得分:0)

分组依据搜索视图不在您的操作选项中,因此您必须编辑搜索视图:

   <record model="ir.ui.view" id="stock_picking_filter_city_search">
        <field name="name">stock.picking.tree.filter_search</field>
        <field name="model">stock.picking</field>
        <field name="arch" type="xml">
            <search string="City">
                <filter name="city" string="City" context="{'group_by':'city'}"/>


                <group expand="0" string="Grouper par">
                    <filter string="City" icon="terp-personal" domain="[]" context="{'group_by':'city'}"/>
                </group>

             </search>
         </field>
   </record>