Odoo Help

5

1
3 Answers
1
Avatar

Emipro Technologies Pvt. Ltd.

--Emipro Technologies Pvt. Ltd.--
7542
| 7 7 10
Rajkot, Índia
--Emipro Technologies Pvt. Ltd.--

Emipro has been providing a wide range of business solutions in the domain of ERP & eCommerce. We take pride in serving 1000s of contented customers across the globe with strong roots in the US, Europe & India. Being a Certified Odoo Gold Partner in India as well as the United States, we bring our rich professional experience and unrivaled technical competence to help our customers obtain efficient and cost-effective business solutions in Odoo. With our team of 50+ Odoo Experts and highly experienced business analysts, we serve our customers which are companies of all sizes, ranging from start-ups to large enterprises. 

Our ERP Services:

  • Business Need Analysis & GAP Analysis

  • ERP Migration

  • Odoo Consultancy

  • Odoo Implementation & Customization

  • Odoo Training & Support

  • Odoo Website & eCommerce Development

  • Odoo Integration (Marketplaces, eCommerce platforms, Shipping Carriers, Payment Gateways etc.)

Our Achievements:


Reach Us:

Website: www.emiprotechnologies.com

Email: info@emiprotechnologies.com

Skype: emiprotech

Emipro Technologies Pvt. Ltd.
22/05/15 02:36

Hi,

To achieve your goal that inherit one view and do not want to change in base view then you have to define new view of the same object without inherit any other view. If you have perform inheritance then base view will always be changed.

So, just make your own new view and set it inside your menu/action. thats it.


1 Comment
Eduardo BP
22/05/15 10:53

Thanks for your answer, but what I want is not to have the same code of the view repeated two times: in the base view and the inheriting view. I only want to delete one element from the base view in my inheriting view without repeating the same xml code. It is the 'don't repeat yourself' principle. But I'm not sure whether this is possible in Odoo.

0
Sehrish
27/03/18 06:59

In Odoo/OpenERP we can inherit or use existing modules object/class/model and views. We can also inherit single field of existing modules. The question is why we need such inheritance.

The purpose of inheritance or why we need inheritance is given below:

  1. To change attributes of some fields which exists on existing/custom model (e.g. making fields readonly,invisible)

  2. To add/modify/delete old or new fields in existing/custom model (e.g. Product, Sales, HR, Fleet Management, Attendance modules model etc)

  3. We can also add buttons in already existing/custom model (form and tree) view by using inheritance

Models.py

class groups(models.Model):
 _inherit = 'res.groups'
 # we inherited res.groups model which is Odoo/OpenERP built in model and created two fields in that model.
 field_1 = fields.Char(required=True,string="Field One")
 field_2 = fields.Boolean(default=False,string="Field Two") 

XML

<openerp>
    <data>
        <record model="ir.ui.view" id="res_group_form_view_inherited">
            <field name="name">res.group.form.view.inherited</field>
            <field name="model">res.groups</field>
            <field name="inherit_id" ref="base.view_groups_form" />
            <!-- <field name="groups_id" eval="[(6, 0, [ref('obe_core.obe_coordinator')])]"/> -->
            <field name="priority" eval="15"/>
            <field name="arch" type="xml">

                <xpath expr="//field[@name='name']" position="after">
                    <field  name="field_1"/>
                </xpath>                
                
                <xpath expr="//field[@name='user_name']" position="after">
                    <field  name="field_2"/>
                </xpath>        

            </field>                               
        </record>
    </data>
</openerp>  

You can get more detail about inheritance from below link:

\http://learnopenerp.blogspot.com/2018/01/inheritance-in-models-and-views.html

Ask a Question
Writer
Keep Informed
3 follower(s)
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.

Register
Odoo Training Center

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

Test it now