0
votes

I created a special tree view for res.partner that help me modify records on the fly. I put this view in a special Menu: test Configuration / Modification Rapide / Modification Contacts.

Everything is working fine expect that whenever there's a res.partner tree it's my tree view that is used.

Is there a way to use my custom tree view only from my Custom menu. and every place else is the default tree view that is used ?

<record model="ir.ui.view" id="view_test_contact_tree">
    <field name="name">res.partner.tree.inherit</field>         
    <field name="model">res.partner</field>
    <field name="inherit_id" ref="base.view_partner_tree"/>
    <field name="arch" type="xml">
        <field name="email" position="replace" />
        <field name="phone" position="replace" />
        <xpath expr="//tree[@string='Contacts']" position="attributes">
            <attribute name="editable">bottom</attribute>
        </xpath>
        <xpath expr="/tree/field[@name='display_name']" position="before">
            <field name="isBuyer" string="A"/>
            <field name="isSeller" string="V"/>
            <field name="isSupplier" string="F"/>
            <field name="isMiddle" string="I"/>
            <field name="isBackOffice" string="B"/>
        </xpath>
        <xpath expr="/tree/field[@name='display_name']" position="after">
            <field name="mobile"/>                  
            <field name="phone"/>
            <field name="email"/>
        </xpath>
    </field>
</record>

        <record model="ir.actions.act_window" id="action_res_partner_rel10">
            <field name="name">Menu</field>
            <field name="res_model">res.partner</field>
            <field name="view_mode">tree</field>
        </record>

        <menuitem name="test Configuration" id="test_config_id" sequence="450"/>
            <menuitem name="Modification Rapide" id="modif_id" parent="test_contact.test_config_id" sequence="20" />
            <menuitem name="Modification Contacts" id="sub_gestion_modif_id" parent="modif_id" sequence="11" action="action_res_partner_rel10"/>
1

1 Answers

0
votes

As I understand you want to show your own created tree view in this menu.

So for this you have to pass your create tree view in ref of action to open your tree view

Like:

      <record id="action_quotations" model="ir.actions.act_window">
            <field name="name">Quotations</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.order</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="view_quotation_tree"/> <======= your tree view id
            <field name="view_mode">tree,form,calendar,graph</field>
            <field name="context">{'search_default_my_sale_orders_filter': 1}</field>
            <field name="domain">[('state','in',('draft','sent','cancel'))]</field>               
       </record>

you have not have to inherit exits view and change in this, instead of create new tree view and pass in actions

Hope this help