Skip to Content
Menu
This question has been flagged
4 Replies
8557 Views

How can I add a new page or a tab in an odoo module?

like this: https://www.screencast.com/t/y54jT9Sm23


I am new to odoo, and currently using version10. Any help would be appreciated. Thanks in advance.

Avatar
Discard

hi, please go through Odoo's docs about building a module https://www.odoo.com/documentation/10.0/howtos/backend.html

Author

Yes, I did went through the documentation, but I am using Windows, so that isn't working well.

Best Answer

It is <menuitem>

Watch this: How to create Models and Views in Odoo 10 

custom_module
|__ models
   |     |__ custom_models.py
| |__ __init__.py
|__ views
   |     |__ custom_view.xml
   |___ __init__.py
|___ __manifest__.py

in custom_module/ __init__.py.

import models

in custom_module/models/ __init__.py.

import custom_models


Avatar
Discard

I have added the structure of module

Author Best Answer

Hello Shameem,

I went through your videos, they were very helpful, thanks for that! But when I myself created a new menu-item (Top-menu), it isn't appearing up on my dashboard. Everything else is running fine, no errors, but still, the Top menu and the sub menu aren't appearing on the screen. How should I resolve this?

Here's the code of __manifest__.py:

{
    'name': "Tracking",
    'summary': """Manage tracking""",
    'description': """
        Tracking orders to and from the company
    """,
    'author': "A1",
    'version': '1.0', 
    'depends': ['base'], 
    'data': [ 
  'views/custom_views.xml'
    ],
 'installable': True,
    'auto_install': True,
    'application': True,
}


Here's the code of custom_models.py:


from odoo import models, fields

class CustomModel(models.Model):
    _name = 'custom.model'

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



Here's the code of custom_views.xml:

<?xml version="1.0" encoding="utf-8" ?>
<odoo>
  <menuitem id="custom_top_menu" name="Tracking"/>
  <menuitem id="custom_sub_menu" name="Track orders" parent="custom_top_menu"/>
  
  <record model= "ir.actions.act_window" id="custom_action_ingoing">
   <field name="name">Incoming</field>
   <field name="res_model">custom.model</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">Create the first incoming tracking order
    </p>
   </field>
  </record>
   
  <record model="ir.ui.view" id="tree_custom_model">
   <field name="name">custom.model.tree</field>
   <field name="model">custom.model</field>
   <field name="arch" type="xml">
    <tree>
     <field name="name" required="1" />
    </tree>
   </field>
  </record>
  
  <record model="ir.ui.view" id="form_custom_model">
   <field name="name">custom.model.form</field>
   <field name="model">custom.model</field>
   <field name="arch" type="xml">
    <form>
     <sheet>
      <group>
       <group>
        <field name="name" required="1" />
       </group>
      </group>
     </sheet> 
    </form>
   </field>
  </record>
  
  <menuitem id="custom_child_menu1" name="Incoming" parent="custom_sub_menu"/>

</odoo>

Avatar
Discard
Author

Hello Shameem, it is exactly what I did. but still, no screen or top menu is appearing on my odoo server.

Related Posts Replies Views Activity
0
Oct 18
3640
2
Nov 24
25087
2
May 24
5519
3
Mar 24
4964
0
Mar 24
262