Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

3

How to add new tab to module?

By
Maath
on 5/30/13, 5:14 AM 11,830 views

Hi,

My question is how to add new tab or (tabs) in my module or existing module

I know the we need to inherit the module we want to add some things and do our changes (As what I do previously (adding one2may & many2one fields))

see below picture will explain what I need

image description

Thank you in advance

5

Atul Arvind

--Atul Arvind--
1854
| 3 3 5
India
--Atul Arvind--

Hello, 

I am odoo Enthusiast/Consultant from Baroda, Gujarat, India. Working with odoo from v5 to v9 and other opensource technology since 4+ years. Having Strong Expertise in

Requirement gathering & Gap Analysis

Odoo Development

Odoo Customization

Odoo Training

Odoo Integration

Server Administration

Odoo Migration

Implementation

I am also active on StackOverflow.

or 


Atul Arvind
On 7/23/15, 5:03 AM

To add page in employee after personal information tab you need to inherit the employee form view in xml like,

 <record id="view_employee_form" model="ir.ui.view">
   	<field name="name">hr.employee.form</field>
    <field name="model">hr.employee</field>
    <field name="inherit_id" ref="view_employee_form"/>
    <field name="arch" type="xml">
	    <xpath expr="//page[@string='Personal Information']" position='after'>
	    	<page string='My new tab'>
	    		
	    	</page>
	    </xpath>
    </field>
</record>
5
Indrabhan Bhamare
On 7/23/15, 2:54 AM

hello Math

Here for you I'm adding new tab in "Quotations" of "sale" module,this is similar to your requirement

Example.py

from openerp import fields, models, api, _

class class_name(models.Model):

    _inherit = 'sale.order'
    <fields name="..."/>

Example.xml

<record id="view_sale_order_tree" model="ir.ui.view">
<field name="name">view.sale.order.tree</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">

<xpath expr="//page[@string='Other Information']" position="after">
<page string="My_New_Tab">
<field name='My_new_fields'/>
</page>
   </xpath>

</field>
</record>


4

In form view, inside <notebook> tag you can add as many pages(TAB) by this syntax

 <notebook>
     <page string="Your Tab1">
         <field name="..."/>
     </page>  
     <page string="Your Tab2">
         <field name="..."/>
     </page>   
 </notebook>
3

Andreas Maertens

--Andreas Maertens--
912
| 5 5 7
Finsterwalde, Germany
--Andreas Maertens--

I develop odoo8.0 modules

Andreas Maertens
On 5/30/13, 6:30 AM

You need to add a new page in the notebook in the View. Are you creating an own Addon/Module to alter the partner page?

In case of you do please take a look on that: You need to inherit from the partner view in maybe partner_view.xml:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
  <data>
    <!--
    Partners Extension
  -->

    <record id="view_partner_property_form" model="ir.ui.view">
        <field name="name">res.partner.stock.property.form.inherit</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="product.view_partner_property_form"/>
        <field name="arch" type="xml">
            <notebook position="inside">
                <page string="My New Tab">
                    <field name="..."/>
                </page>
            </notebook>
        </field>
    </record>

  </data>
</openerp>

What I do without inherit view (inherit the module) <!-- ============== student================= --> <!-- 1st part of the sim_view start--> <record model="ir.ui.view" id="student_form"> <field name="name">Student</field> <field name="model">sim77.student</field> <field name="type">form</field> <field name="arch" type="xml"> <form string="Student"> <field name="name"/> <field name="student_name"/>

<field name="gender"/> <field name="contract_id"/> </form> </field> </record> <!-- 1st part of the sim_view end--> can you help ? where I put code of new page?

Maath
on 5/30/13, 6:39 AM

Then add a notebook to your view. That looks exactly as above code just without the "inherit_id" tag nor the position attribute in <notebook>. Notebook adds the Space for your Tabs to the form.

Andreas Maertens
on 5/30/13, 7:17 AM

You put the code of the new File in a separate .xml file. Then you need to add the .xml in your __openerp__.py under "update_xml". Just take a look to other addons therefor.

Andreas Maertens
on 5/30/13, 7:19 AM

Did that solved your Problem? If it does please mark one of the correct answers to help others to find the solution faster

Andreas Maertens
on 6/13/13, 4:01 AM

Great, this works fine for me. I have a one2many field in the partner model that creates a relationship with custom model. How can I add a "Create" button to the tab so that it pop up the view of the custom model?

Cyrus Waithaka
on 9/15/14, 5:06 AM
2

Ghanshyam Prajapati

--Ghanshyam Prajapati--
1377
| 4 4 8
Pune, India
--Ghanshyam Prajapati--
OpenERP Developer
Ghanshyam Prajapati
On 5/30/13, 6:35 AM

inside <notebook> tag, after <page string="Personal Information"> </page> put your new tab, <page string="My Tab"> </page>

1
khudrath
On 7/3/14, 3:02 AM

How can we set one tab or page as default, i.e., when i open the screen that that tab opens by default

 

I would want to know too!

Pascal Tremblay
on 9/26/14, 7:51 AM

Put it the first not the last hhhh ;)

Drees Far
on 7/23/15, 8:19 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/30/13, 5:14 AM
Seen: 11830 times
Last updated: 1/6/16, 7:13 AM