Odoo Help


How can i create a view to inherit a view from a base class

Hachem Chraiti
on 4/3/14, 8:24 PM 1,445 views

How can i create a view to inherit from this class

--base class:

from openerp.osv import fields, osv

class pos_personne(osv.osv): _name = 'pos.personne1' _columns = { 'pos_personne_id' : fields.integer('ID',size=64), 'personne_nom': fields.char('Nom de la personne', size=128, required=True), 'personne_prenom': fields.char('Prenom de la personne', size=128, required=True), 'personne_date': fields.date('Date Naissance'), 'personne_lieu': fields.char('LIeu Naissance', size=128, required=True), 'personne_travail':fields.char('Travail de la personne', size=128, required=True), }

_defaults = {
    'personne_nom' : '',
    'personne_prenom': '',


base view

<openerp> <data> <record id="pos_personne_form" model="ir.ui.view"> <field name="name">pos.personne1.form</field> <field name="model">pos.personne1</field> <field name="arch" type="xml"> <form string="personne" version="7.0"> <group col="4"> <field name="pos_personne_id"/> <field name="personne_nom"/> <field name="personne_prenom"/> <field name="personne_date"/> <field name="personne_lieu"/> <field name="personne_travail"/> </group> </form> </field> </record>

    <record id="pos_personne_tree" model="ir.ui.view">
        <field name="name">pos.personne1.tree</field>
        <field name="model">pos.personne1</field>
        <field name="arch" type="xml">
            <tree string="personne">
                <field name="pos_personne_id" />
                <field name="personne_nom" />
                <field name="personne_prenom" />
                <field name="personne_date" />
                <field name="personne_lieu" />
                <field name="personne_travail" />

    <record model="ir.ui.view" id="pos_personne_search">
        <field name="name">pos.personne1.search</field>
        <field name="model">pos.personne1</field>
        <field name="arch" type="xml">
            <search string="personne Management">
                <field name="personne_nom" />

    <menuitem name="Faculty Management" id="menu_point_root"
        sequence="30" />

    <record model="ir.actions.act_window" id="action_pos_personne">
        <field name="name">personne</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">pos.personne1</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="view_id" ref="pos_personne_tree" />
        <field name="context">{"search_default_filter_see_all":1}</field>
        <field name="help" type="html">

            Click here to create a Personnes for Hachem.

    <menuitem name="personnes Menu" id="menu_point_root_personnes"
        parent="menu_point_root" sequence="19" />
    <menuitem id="menu_action_pos_personne" parent="menu_point_root_personnes"
        action="action_pos_personne" />
    <!-- # -->



--class of inheritance

from openerp.osv import fields, osv

class pos_personneFils(osv.osv): _name = 'pos.personnefils1' _inherit = 'res.partner' _columns = { 'numero':fields.char('Numero',size=64,required=True), }

_defaults = {
    'numero' : '',


the inherit view ????????

On 4/4/14, 11:12 AM

In your view, add the id of the view you want to inherit like that:

        <field name="inherit_id" ref="point_of_sale.view_report_pos_order_tree"/>

ref must be name_of_the_xml_module.id_of_the_view

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

0 follower(s)


Asked: 4/3/14, 8:24 PM
Seen: 1445 times
Last updated: 3/16/15, 8:10 AM