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.

0

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

By
Hachem Chraiti
on 4/3/14, 8:24 PM 796 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': '',
    }

pos_personne()

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" />
            </tree>
        </field>
    </record>


    <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" />
            </search>
        </field>
    </record>

    <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.
        </field>
    </record>


    <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" />
    <!-- # -->


</data>

</openerp>

--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' : '',
}

pos_personneFils()

the inherit view ????????

0

Jagdish Panchal

--Jagdish Panchal--
2674
| 5 3 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 4/4/14, 2:14 AM

How can i create a view to inherit from this class

--base class:

class pos_personne(osv.osv): 
from openerp.osv import fields, 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': '',
    }

pos_personne()

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" />
        </tree>
    </field>
</record>


<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" />
        </search>
    </field>
</record>

<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.
    </field>
</record>


<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" />
<!-- # -->

</data>

</openerp>

--class of inheritance

from openerp.osv import fields, osv

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

_defaults = {
    'numero' : '',
}

pos_personneFils()

xml file

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
         <record id="view_partner_form1_inherit" model="ir.ui.view">
            <field name="name">res.partner.inherits.test1</field>
            <field name="type">form</field>
            <field name="model">res.partner</field>
            <field name="inherit_id" ref="base.view_partner_form"/>
            <field name="arch" type="xml">
                <!-- added 10-03-2014 -->

                <field name="email" position="replace">
                    <field name="numero" />
                </field> 
            </field>
        </record>

    </data>
</openerp>

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: 4/3/14, 8:24 PM
Seen: 796 times
Last updated: 3/16/15, 8:10 AM