Skip to Content
Menú
This question has been flagged
3 Respostes
9929 Vistes

Here's the thing, i want to go to another tree view of another module when clicking on an element of the first tree view, instead of the predetermined form view. What i tried:

        <record id="view_destination_tree" model="ir.ui.view">
                    <field name="name">delivery.destination</field>
                    <field name="model">delivery.destination</field>
                    <field name="priority">1</field>
                    <field name="arch" type="xml">
                        <tree string="Destinos">
                            <field name="coordenadas" string="Coordenadas"/>
                            <field name="client" string="Cliente"/>
                            <field name="is_default" string="Predeterminado"/>
                        </tree>
                    </field>
        </record>

        <record id="view_clients" model="ir.ui.view">
                    <field name="name">client.dest</field>
                    <field name="model">res.partner</field>
                    <field name="priority">1</field>
                    <field name="arch" type="xml">
                        <tree string="Clientes con Destinos">
                            <field name="name" string="Cliente"/>
                            <field name="has_destination" string="Tiene destino"/>
                        </tree>
                    </field>
        </record>

        <record model="ir.actions.act_window" id="action_clients">

                    <field name="name">Lista de Destinos</field>

                    <field name="res_model">res.partner</field>
                    
                    <field name="view_id" ref="view_clients"/>

                    <field name="view_type">tree</field>

                    <field name="view_mode">tree</field>

        </record>

        <record model="ir.actions.act_window" id="action_tree_destination">

                    <field name="name">Lista de Destinos</field>

                    <field name="res_model">delivery.destination</field>
                    
                    <field name="view_id" ref="view_destination_tree"/>

                    <field name="view_type">tree</field>

                    <field name="view_mode">tree</field>

        </record>

<menuitem id="main_menu_ruta" name="Rutas"/>
            <menuitem id="Rutas" parent="main_menu_ruta" name="Rutas"/>
            <menuitem id="Destinos" parent="Rutas" action="action_tree_destination" name="Destinos"/>

I want to call action_clients when clicking in view_destination_tree. I tried some things but the clicking doesn't get me anywhere.

Avatar
Descartar

Hello,

Please try to this ways:

<button name="%(action_tree_destination)d" string="Open Tree" class="oe_edit_only" type="action"></button>

Best Answer

Hi,

You can try the code below

<record id="action_tree_destination" model="ir.actions.act_window">
<field name="name">Lista de Destinos</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">delivery.destination</field>
<field name="view_mode">tree,form</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('module_name.view_id')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('module_name.view_id')})]"/>
</record>

Regards

Avatar
Descartar
Related Posts Respostes Vistes Activitat
2
de set. 23
6955
2
de març 23
45608
2
de des. 23
56233
0
de març 22
1670
1
d’oct. 19
3855