Odoo Help


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.


In my custom module, I am having trouble getting my fields to show up correctly. I am inheriting res.partner and making changes to the FORM view.

on 10/3/16, 12:40 PM 91 views

When I inherit from base view "base.view_partner_form"
it doesn't show the regular customer view as in sales, instead I got what in the pic below


My code as below

class Director(Model):
    _name = 'director'   
_inherit = 'res.partner'   

gender = Selection([('male', 'Male'), ('female', 'Female')], default='male')   
end_date = Date()   
degree = Integer(default=1)
    # communication tab   
passport = Char()   
passport_expire = Date()   
driving_license = Char()   
visa_date = Date()   
visa_expire = Date()
<record id="view_partner_form_inherited" model="ir.ui.view">
            <field name="name">Inherited Form View</field>
            <field name="model">director</field>
            <field name="inherit_id" ref="base.view_partner_form"/>
            <field name="arch" type="xml">
                <!--<xpath expr="//field[@name='fax']" position="attributes">-->
               <!--<attribute name="invisible">1</attribute>-->
                <!--<xpath expr="//field[@name='fax']" position="after">-->
                <!--<field name='gender'/>-->

class Director(Model):

_name = 'director'

_inherit = 'res.partner'

This style of inheritance is extension which means 'director' model represents a new table based on 'res.partner', so that modify 'director' won't affect 'res.partner'. You may try classical inheritance below.

class Director(Model):

_inherit = 'res.partner'

Monchai P
on 10/4/16, 12:58 AM

Actually it works, but is there a way to inherit as extension so I can refer to the model with its name "director" not "res,partner"?

on 10/4/16, 10:37 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)


Asked: 10/3/16, 12:40 PM
Seen: 91 times
Last updated: 10/3/16, 2:21 PM