Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
234 Vistas

I want to keep only list, kanban and form view for my crm.lead model and hide the rest of the views. The following code has not helped:

<record model="ir.actions.act_window" id="crm.crm_lead_action_pipeline">

    <field name="name">Pipeline</field>

    <field name="res_model">crm.lead</field>

    <field name="view_mode">list,kanban,form</field> <!-- ,graph,pivot,calendar,activity -->

    <field name="domain">[('type','=','opportunity')]</field>

    <field name="context">{'default_type': 'opportunity', 'search_default_assigned_to_me': 1}</field>

    <field name="search_view_id" ref="crm.view_crm_case_opportunities_filter"/>

  </record>


  <record model="ir.actions.act_window" id="crm.crm_lead_opportunities">

    <field name="name">Opportunities</field>

    <field name="res_model">crm.lead</field>

    <field name="view_mode">list,kanban,form</field>

    <field name="domain">[('type','=','opportunity')]</field>

    <field name="context">{'default_type': 'opportunity',}</field>

    <field name="search_view_id" ref="crm.view_crm_case_opportunities_filter"/>

  </record>

Odoo v18 Community edition

Avatar
Descartar
Mejor respuesta

Hi,

If you want to hide views like Pivot, Calendar, and Activity from the CRM pipeline (crm.lead), just setting view_mode in your action is not enough — those views are still available if they exist in the system.

Solution:


You need to deactivate the extra views like this:


<!-- Hide Pivot view -->

<record id="crm.crm_case_graph_view_opportunities" model="ir.ui.view">

    <field name="active">False</field>

</record>


<!-- Hide Calendar view -->

<record id="crm.crm_case_calendar_view_opportunities" model="ir.ui.view">

    <field name="active">False</field>

</record>


<!-- Hide Activity view -->

<record id="crm.crm_lead_view_activity" model="ir.ui.view">

    <field name="active">False</field>

</record>


After this:


    Add the code to your custom module.


    Upgrade the module.


    Refresh the page. Now only List, Kanban, and Form views will show.

Hope it helps.

Avatar
Descartar
Autor

These views are still visible and accessible from the header.

Publicaciones relacionadas Respuestas Vistas Actividad
1
jun 25
241
0
jun 25
45
2
jun 25
98
2
jun 25
397
1
may 25
433