Skip to Content
Menu
This question has been flagged
2 Replies
2947 Views

Hi, 

I created new module named Dossier with a new model:


class Dossier(models.Model):

    _name = 'sale.dossier' 

    _description = 'Dossier'

    name = fields.Char(string="Name", required=True)  

    date_creation = fields.Date(string="Creation date") 


and a new menuitem in Sales:

<menuitem name="Dossiers" 

            id="sales_dossier" 

            parent="sale.sale_menu_root" 

            action="action_dossier"/> 


But when I create an action to send me to treeview or formview of Dossier an wizard pops up

I need it to redirect me to a normal view (tree or form), any idea how to fix it?


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

        <field name="name">Dossiers</field>

        <field name="type">ir.actions.act_window</field>

        <field name="res_model">sale.dossier</field>

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

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

        <field name="help" type="html">

            <p class="o_view_nocontent_smiling_face">

                Create your first dossier!

            </p>

        </field>

    </record>


    <record id="dossier_form" model="ir.ui.view">

        <field name="name">sale.dossier.form</field>

        <field name="model">sale.dossier</field>

        <field name="arch" type="xml">

            <form string="Dossier">

                <group>

                    <field name="name"/>

                    <field name="date_creation"/>

                </group>

            </form>

        </field>

    </record>


    <record id="dossier_tree" model="ir.ui.view">

        <field name="name">sale.dossier.tree</field>

        <field name="model">sale.dossier</field>

        <field name="arch" type="xml">

            <tree string="Dossiers">

                <field name="name"/>

                <field name="date_creation"/>

            </tree>

        </field>

    </record>

Avatar
Discard
Best Answer

Hi Jakub,

Can you try add this in your action, just below view_mode

<field name="view_ids" eval="[(5, 0, 0),

                (0, 0, {'view_mode': 'tree', 'view_id': ref('dossier_tree')}),

                (0, 0, {'view_mode': 'form', 'view_id': ref('dossier_form')})]"/>

Avatar
Discard
Related Posts Replies Views Activity
1
Sep 23
3581
1
Aug 23
796
2
Jun 22
2748
0
Sep 21
1252
0
Sep 20
1731