Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
5 Risposte
6158 Visualizzazioni

in the detailview of res.partner on the right upper position there are some buttons to related modules (e.a. opportunities, meetings,sales...)

how can i hide such a button?

e.a. the Button that shows the connected opportunities. But i do not want to uninstall the opportunities.


Avatar
Abbandona
Risposta migliore

You have to inherit the form view in which button is define for ex: Opportunities and Meetings button is in the CRM -> res_partner_views.xml and Sales button is in the Sale -> res_partner_views.xml(Odoo version 12).

Just add the invisible="1" in button tag in your inherited view.


Avatar
Abbandona
Autore

but how can i reference to them by xpath?

Autore Risposta migliore

i found the source that adds the buttons but i think the names of the buttons are dynamically:


<button class="oe_stat_button o_res_partner_tip_opp" type="action" attrs="{'invisible': [('customer', '=', False)]}" name="562" icon="fa-star" context="{'search_default_partner_id': active_id}" modifiers="{'invisible':[['customer','=',false]]}" options="{}">
    <field string="Opportunities" name="opportunity_count" widget="statinfo" modifiers="{'readonly':true}"/>
    <field name="partner_gid" invisible="True" modifiers="{'invisible':true}"/>
    <field name="additional_info" invisible="True" modifiers="{'invisible':true}"/>
</button>
           
<button type="action" class="oe_stat_button" icon="fa-credit-card" name="301" context="{'search_default_partner_id': active_id}" modifiers="{}" options="{}">
    <div class="o_form_field o_stat_info" modifiers="{}">
        <span class="o_stat_value" modifiers="{}">
            <field name="payment_token_count" widget="statinfo" nolabel="1" modifiers="{'readonly':true}"/>
        </span>
        <span class="o_stat_text" modifiers="{}">
            Credit card(s)
        </span>
    </div>
</button>


so how can i hide such buttons?

Avatar
Abbandona

Inherit and replace

<button class="oe_stat_button o_res_partner_tip_opp" position='replace'>

</button>

Risposta migliore

Inherit the form view and add invisible attribute for the fields which one is not required

Avatar
Abbandona
Autore

but where can i find out which element this is exactly? in developer Mode i do not see infos when mouseover this element

Risposta migliore

If you wan't to disable it in the current browser window,

You can goto developer mode and in the form view of partner, click on the bug icon, --> edit form view.

In the view definition, find where  the button is defined and give an attribute named

invisible="1"

For example, if your button is defined as 

 <button name="graph_function" type="object" class="oe_stat_button" icon="fa-sitemap">Relation</button>

You can then add invisible as 

 <button name="graph_function" type="object" class="oe_stat_button" icon="fa-sitemap" invisible="1">Relation</button>
Remember that this is temporary, If you change the browser window, this would still be visible.

Inorder that you want to hide them permanently, you'll have to do backend coding by inheriting the view and adding the attribute "invisible" for the button(s).

Avatar
Abbandona