Odoo Help


Custom view for res.partner

on 3/24/15, 3:46 AM 1,711 views

I want to create new form view and tree view for res.partner with only 2-3 fields. Also i want res.partner form and tree view as it is.

I want to create new menu and puts new created view under that. How to possible ?

On 3/24/15, 6:23 AM


Not sure if I understand your question properly, but I guess you'd like to create a new form and tree for res.partner under a new menu.

To achieve this you create a new record in xml, from the model res.partner (not inheriting, since it will not use anything from the res,partner)

The next thing to do is create a python class that inherits from res.partner and create the needed fields here.

in xml:

<record model="ir.ui.view" id="view_partner_form_custom">
            <field name="name">view.partner.form.custom</field>
            <field name="model">res.partner</field>
            <field name="arch" type="xml">
                    <form string="New Form">
                         <field name="field1"/>
                         <field name="field2"/>

<record model="ir.ui.view" id="view_partner_tree_custom">
            <field name="name">view.partner.tree.custom</field>
            <field name="model">res.partner</field>
            <field name="arch" type="xml">
                         <field name="field1"/>
                         <field name="field2"/>

<record model="ir.actions.act_window" id="custom_partner_action">
            <field name="name">Custom Partner</field>
            <field name="res_model">res.partner</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>

<!-- top level menu: no parent -->

<menuitem id="custom_partner_menu" name="Custom Partner" action="custom_partner_action"/>


in python:

class custom_partner(models.Model):
    _inherit = 'res.partner'
    field1 = fields.Char()
    field2 = fields.Char()

This should get you some a new menuitem, when you click this item, the formview opens. Might need a tweak here and there. Since I did not test this code.

Michael Pol
On 3/24/15, 4:31 AM

You should read this document once.


On 3/25/15, 1:17 AM

Hello Sonny

I already tried this whatever you written here. it open default form/tree view (original) of res.partner. I want only some fields in my views.

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 3/24/15, 3:46 AM
Seen: 1711 times
Last updated: 3/25/15, 1:17 AM