Skip to Content
Menu
This question has been flagged
2 Replies
4446 Views

Hello, I need to sort by means of a date field my opportunities in the Kanban view in the CRM module. I am triying to do this with a filter. I know I can do it in the tree view with just a click on the field I want to order, but I could not do it in the view Kanban. I need to make the date closest to the farthest date. I have tried the following:

<record id="crm_search_view_oppor" model="ir.ui.view">
    <field name="name">crm.lead.search.opportunity</field>
    <field name="model">crm.lead</field>
    <field name="inherit_id" ref="crm.view_crm_case_opportunities_filter"/>
    <field name="arch" type="xml">
        <xpath expr="//filter[@name='message_needaction']" position="replace">
            <filter name="filtro_fecha_hora_inicio_evento" string="Fecha de evento" domain="[('fecha_hora_inicio_evento', '=', time.strftime('%Y-%m-%d'))]"/>
        </xpath>
    </field>

</record>

With this filter my fields sorts like this:

2018/04/15

2018/03/15

2018/02/15

But I need this:

2018/02/15

2018/03/15

2018/04/15

Avatar
Discard

you can make the models order by param _order = 'field ASC'

Best Answer

hi,

in your module_py.py file,

add after _inherit parameter [same as @Hilar answer]

 _order = 'fecha_hora_inicio_evento ASC'
after that restart server and upgrade module.
Avatar
Discard
Author

Thanks! that solved my problem.