Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to show submenus in Sale module in OpenERP(Odoo)

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.26k
    Comment on it

    In OpenERP first, create custom module than inherits the sale menu and pass the view_mode in your menu file, follow these steps show below

    Step1- The first step is to create a module i.e test and then create a file test.py and in this file, create an object in your module.

    Use this code given below

    from dateutil.relativedelta import relativedelta
    from openerp import api,models,_
    from openerp.osv import osv, fields
    class test(osv.osv):
        _name = 'test'
        _rec_name = 'reference'
        _columns = {
                     'invoice_total_paid' : fields.function("Total Amount"),
                    }
    test()

     

    Step2- Then create, another file i.e as test.xml file in your test module and create a view for your module.

    Use this code show in below

    <?xml version="1.0" encoding="utf-8"?>
    <openerp>
        <data>
     <!--  Here is a test order tree view -->   
          <record model="ir.ui.view" id="test_order_tree_view">
                <field name="name">test.order.tree.view</field>
                <field name="model">test</field>
                <field name="type">tree</field>
                <field name="arch" type="xml">
                    <tree string="test Orders">
                        <field name="invoice_total_paid"/>
                     </tree>
                </field>
          </record>
    
    <!--  Here is a test order tree view --> 
    
          <record model="ir.ui.view" id="test_order_form_view">
                <field name="name">rent.order.form.view</field>
                <field name="model">rent.order</field>
                <field name="type">form</field>
                <field name="arch" type="xml">
                    <form string="Rent Order">
                        <group colspan="4" col="6">
                            <field name="invoice_total_paid"/> 
                        </group>
                     </form>
                  </field>
           </record>
       </data>
    </openerp>

     

    Step3- Then we create another file i.e as menus.xml file in your test module and pass views id in this file and also create a menu in this file.

    Use this code show in below

    <?xml version="1.0" encoding="utf-8"?>
    <openerp>
        <data>
            <!--
                Basic Menu (Sales->Sale Orders)
            -->
            <record model="ir.actions.act_window" id="test_action_form">
                <field name="name">test Order</field>
                <field name="res_model">test</field>
                <field name="view_type">form</field>
                <field name="view_mode">tree,form</field>
                <field name="usage">menu</field>
                <field name="search_view_id" ref="test_order_form_view"/>
            </record>
            <menuitem id="rent_order_menu" parent="base.menu_sales" groups="base.group_sale_salesman"
                      name="test Orders" action="test_action_form"/>  
       </data>                
    </openerp>
       

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: