تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
292 أدوات العرض

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

الصورة الرمزية
إهمال
أفضل إجابة

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.

الصورة الرمزية
إهمال
الكاتب

These views are still visible and accessible from the header.

المنشورات ذات الصلة الردود أدوات العرض النشاط
0
يونيو 25
169
1
يونيو 25
159
1
يونيو 25
367
1
يونيو 25
167
1
يونيو 25
147