0
votes

I try to create a menuitem + action + tree base + form with inherit

I do not want to replace the view that is used in the rest of oudoo

But not working

Odoo 9

thx for help D:

My xml file with records

    <menuitem id="menu_picking_listing" name="Picking List" parent="purchase.menu_procurement_management" sequence="20" action="action_picking_listing"/>

    <record model="ir.actions.act_window" id="action_picking_listing">
        <field name="name">JobApplication Application</field>
        <field name="type">ir.actions.act_window</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="help" type="html"> 
            <p class="oe_view_nocontent_create"> Click here to create a Job.</p>
        </field>
        <field name="res_model">stock.picking</field>
    </record>

    <record model="ir.actions.act_window.view" id="action_picking_listing_tree">
        <field name="sequence" eval="1"/>
        <field name="view_mode">tree</field>
        <field name="view_id" ref="stock.vpicktree"/>
        <field name="act_window_id" ref="action_picking_listing"/>
    </record>

    <record model="ir.actions.act_window.view" id="action_picking_listing_form">
        <field name="sequence" eval="2"/>
        <!--<field name="model">stock.picking</field>-->
        <field name="view_mode">form</field>
        <field name="view_id" ref="stock.view_picking_form"/>
        <field name="act_window_id" ref="action_picking_listing"/>
        <field name="arch" type="xml">
            <notebook position="after">
                <page string="Landed Costs">
                    <field name="landed_costs" colspan="4" nolabel="1" />
                </page>
            </notebook>
        </field>
    </record>
1

1 Answers

0
votes

Solution:

XML View -->

    <!-- Definimos un menuitem donde el action es el id del dispatcher de action -->
    <menuitem id="menu_picking_listing" name="Picking List" parent="purchase.menu_procurement_management" sequence="20" action="action_picking_listing"/>

    <!-- Este es el dispatcher de acciones -->
    <record model="ir.actions.act_window" id="action_picking_listing">
        <field name="name">Picking List</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">stock.picking</field>
        <field name="view_mode">tree,form</field>
    </record>

    <!-- Definimos la vista tree y con el view_id le decimos cual es -->
    <record id="accion_vista_arbol_default" model="ir.actions.act_window.view">
        <field eval="15" name="sequence"/>
        <field name="view_mode">tree</field>
        <field name="view_id" ref="stock.vpicktree"/>
        <field name="act_window_id" ref="action_picking_listing"/>
    </record>

    <!-- Definimos la vista form y con el view_id le decimos cual es -->
    <record id="accion_vista_formulario_conlanded" model="ir.actions.act_window.view">
        <field eval="15" name="sequence"/>
        <field name="view_mode">form</field>
        <field name="view_id" ref="stock_landed_costs_fields.sale_picking_listing_form"/>
        <field name="act_window_id" ref="action_picking_listing"/>
    </record>

    <!-- Definimos la vista nueva independiente de todo con un name nuevo y con mode primary le decimos que sea a parte, no heredado -->
    <record model="ir.ui.view" id="sale_picking_listing_form">
        <field name="name">stock.picking.form.inherit</field>
        <field name="model">stock.picking</field>
        <field name="mode">primary</field> <!-- Con esto digo que NO es herencia, que es una vista a parte -->
        <field name="inherit_id" ref="stock.view_picking_form" />
        <field name="arch" type="xml">
            <notebook position="inside">
                <page string="Landed Costs">
                    <field name="landed_costs" colspan="4" nolabel="1" />
                </page>
            </notebook>
        </field>
    </record>
</data>