How to add entry to 'More' menu or top menu to add action on multiple selections?

后端 未结 1 560
忘了有多久
忘了有多久 2020-12-10 19:02

Goal

I want to create delivery from a selection of order lines, but I can\'t get the button to appear.

Module

compose_delivery_order/
├─         


        
相关标签:
1条回答
  • 2020-12-10 19:54

    You need take care of below things while adding new menu on More menu.

    • register form view
    • register action view
    • register ir_values (from where you want to display menu)
    • give proper related view_id reference
    • target attribute in action view
    • give related name for record tag

    Try with below code (add code on .xml file):

    <?xml version="1.0" encoding="utf-8"?>
    <openerp>
        <data>
            <record id="view_create_delivery_button" model="ir.ui.view">
                <field name="name">Create Delivery</field>
                <field name="model">sale.order.line</field>
                <field name="arch" type="xml">
                    <form string="Create Delivery" version="7.0">
    
                        <!-- Design Form or put your field here -->                
                        <footer>
                            <!-- Add button on footer of pop-up window -->
                        </footer>
                   </form>
                </field>
            </record>
    
            <record id="action_create_delivery_button" model="ir.actions.act_window">
                <field name="name">Create Delivery</field>
                <field name="type">ir.actions.act_window</field>
                <field name="res_model">sale.order.line</field>
                <field name="view_type">form</field>
                <field name="view_mode">form</field>
                <field name="view_id" ref="view_create_delivery_button"/>
                <field name="target">new</field>
                <field name="multi">True</field>
            </record>
    
            <record model="ir.values" id="ir_values_create_delivery_button">
                <field name="model_id" ref="sale.model_sale_order_line" />
                <field name="name">Create Delivery</field>
                <field name="key2">client_action_multi</field>
                <field name="value" eval="'ir.actions.act_window,' + str(ref('action_create_delivery_button'))" />
                <field name="key">action</field>
                <field name="model">sale.order.line</field>
            </record>
        </data>
    </openerp>
    
    0 讨论(0)
提交回复
热议问题