Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to inherit delegation and view in OpenERP(Odoo)

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.14k
    Comment on it

    In OpenERP first, we create a module and then inherits to the delegation and views both in your own module.

    Follow these step shown below

    Step1- First we create a module like as: test and then create a test.y file in an own module and pass this file in __init__.py file and inherits the account.invoice object in an own module.

    use this code shown below

    from openerp.osv import osv, fields
    
    class MyAccountInvoice(models.Model):
        _name = 'my.res.partner'
        _inherits = {'account.invoice': 'partner_id'}
        partner_id = fields.Many2one('res.partner', 'Partner Name', required=True)
        test1 = fields.Text('Test1')
        test2= fields.Text('Test2')
    
    MyAccountInvoice()

    Step2- Than we create test.xml file in your own module and pass this file in __openerp__.py file and create view in this test.xml file.
    Use this code given below
    
    <?xml version="1.0"?>
    <openerp>
        <record id="account_view_inherited" model="ir.ui.view">
            <field name="name">Ma fiche partenaire</field>
            <field name="model">account.invoice</field>
            <field name="inherit_id" ref="account.invoice_form" />
            <field name="arch" type="xml">
                <field name="team_id" position="attributes">
                    <attribute name="invisible">1</attribute>
                </field>
                <field name="category_id" position="attributes">
                    <attribute name="string">Type</attribute>
                </field>
               
                <page name="other_info" position="before">
                    <page name="my page" string="page Techniques">
                        <group name="group_technical_information">
                           <field name="partner_id" />
                            <field name="test1" />
                            <field name="test2" />
                        </group>
                    </page>
                </page>
            </field>
        </record>
    <!-- here is tree view   -->
      <record id="account_view_inherited_tree" model="ir.ui.view">
            <field name="name">Ma fiche partenaire</field>
            <field name="model">account.invoice</field>
            <field name="inherit_id" ref="account.invoice_tree" />
            <field name="arch" type="xml">
             <tree>
                        <field name="partner_id">
                            <field name="test1" />
                            <field name="test2" />
                </tree>
               </field> 
        </record>
    </openerp>

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: