You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在自定义模块中隐藏Odoo商机视图的两个继承按钮

How to Hide "Create Quotation" and "Convert to Quotation" Buttons in Odoo CRM Lead View

Got it, let's solve this. Since those two buttons are injected into the CRM lead form via XPath from the sale_crm module, we can override them using Odoo's XML view inheritance in your custom module. Here are two straightforward approaches:

This method modifies the buttons' visibility attribute to make them always invisible, without removing them entirely. Add this XML code to your custom module:

<record id="crm_lead_form_hide_quotation_buttons" model="ir.ui.view">
    <field name="name">crm.lead.form.hide.quotation.buttons</field>
    <field name="model">crm.lead</field>
    <field name="inherit_id" ref="crm.crm_lead_form_view"/>
    <field name="arch" type="xml">
        <!-- Target and hide "Create Quotation" button -->
        <xpath expr="//button[@string='Create Quotation' and @name='618']" position="attributes">
            <attribute name="invisible">1</attribute>
        </xpath>
        <!-- Target and hide "Convert to Quotation" button -->
        <xpath expr="//button[@string='Convert to Quotation' and @name='618']" position="attributes">
            <attribute name="invisible">1</attribute>
        </xpath>
    </field>
</record>

Key Notes:

  • We use the button's string and name attributes to precisely target them (since both share the same name="618" value).
  • Setting invisible="1" overrides the original attrs condition, making the buttons hidden in all cases.

Approach 2: Remove the Buttons Entirely

If you're sure you'll never need these buttons, you can remove them from the view completely:

<record id="crm_lead_form_remove_quotation_buttons" model="ir.ui.view">
    <field name="name">crm.lead.form.remove.quotation.buttons</field>
    <field name="model">crm.lead</field>
    <field name="inherit_id" ref="crm.crm_lead_form_view"/>
    <field name="arch" type="xml">
        <!-- Remove "Create Quotation" button -->
        <xpath expr="//button[@string='Create Quotation' and @name='618']" position="replace"/>
        <!-- Remove "Convert to Quotation" button -->
        <xpath expr="//button[@string='Convert to Quotation' and @name='618']" position="replace"/>
    </field>
</record>

Critical Setup Step:

Don't forget to add sale_crm as a dependency in your custom module's __manifest__.py file. This ensures Odoo loads the original sale_crm view before your inherited view:

'depends': ['base', 'crm', 'sale_crm'],

After adding this code, install/update your custom module, and the buttons will be hidden/removed from the CRM lead form view.

内容的提问来源于stack exchange,提问作者Nebil Aydi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:13:02