Odoo Help


<field name="mode">primary</field> can anyone explain the purpose of this ?

on 7/11/16, 1:09 AM 1,716 views

how it  works? and it's usages?

just saw the above link.. thanks for ur replay.

on 7/11/16, 8:09 AM

Axel Mendoza

--Axel Mendoza--
| 7 8 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza
On 7/11/16, 1:39 AM

That it's an interesting feature of the views inheritance that I like to call it view inheritance by prototype because it's like the model inheritance by prototype where you create a copy of a model using this syntanx:

from openerp import models

class model_class_name(models.Model)
    _name = 'model.name'
    _inherit = 'new.model.name'


Defining the view like using the mode primary is the same as the model example exposed and you will end with a new view that inherit from the inherit_id view reference. That view field is only used in conjunction with the inherit_id field. By default have the value extension that it's the most used and known use.

Let's put an example assuming that you need two views of the model res.partner with different changes in how they fields will be displayed or whatever you need, could be that you don't want to use groups or invisible in all the fields that you need to add or modify in boths of the views or their position varies

<record model="ir.ui.view" id="partner_base_view">

<field name="name">Client</field>

<field name="model">res.partner</field>

<field name="priority">1</field>

<field name="arch" type="xml">

<form string="Patient">


<field name="image" widget='image' class="oe_left oe_avatar" options='{"preview_image": "image_medium", "size": [90, 90]}'/>

<div class="oe_left">

<label class="oe_edit_only" for="name" string="Name" colspan="4"/>

<div class="oe_inline">


<field name="title" domain="[('domain', '=', 'contact')]" options='{"no_open": True}' placeholder="Title" nolabel="1" colspan="1"/>

<field name="name" default_focus="1" placeholder="Name" nolabel="1" colspan="5"/>

<field name="lastname" placeholder="Last Name" required="1" nolabel="1" colspan="6"/>



<field name="category_id" widget="many2many_tags" placeholder="Tags..." colspan="6"/>


<div class="oe_right oe_button_box solt_oe_button_box" name="buttons">

<button class="oe_inline oe_stat_button" style="width: 250px !important;" type="action" name="322" icon="fa-phone" context="{'search_default_partner_id': partner_id, 'default_duration': 1.0}">

<field string="Calls" name="phonecall_count" widget="statinfo"/>



<div class="oe_clear"/>


<page string="Personal Information">


<field name="marital_status"/>

<field name="religion"/>

<field name="ethnic_group"/>


<label for="comments"/>

<field name="comments" placeholder="Comments"/>




<div name="message" class="oe_chatter">

<field name="message_follower_ids" widget="mail_followers" />

<field name="message_ids" widget="mail_thread" />





<record model="ir.ui.view" id="partner_primary_mode_view">

<field name="name">Client Extended</field>

<field name="model">res.partner</field>

<field name="priority">8</field>

<field name="inherit_id" ref="partner_base_view"/>

<field name="mode">primary</field>

<field name="arch" type="xml">

<xpath expr="//form/sheet/notebook" position="inside">

<page string="Extra Info">

<field name="extra_info"/>





thank for ur reply Axel.. :)

on 7/11/16, 2:04 AM

Actually, you put model name= res.partner in both ui views. so what is the use of it? when I run it, it actually replaces partner_base_view. and only showing Partner_primary_mode_view..

on 7/11/16, 3:23 AM

i found it.. i forgot XPATH, same model inheritance. but tell me in which it will be useful for us.

on 7/11/16, 4:38 AM

it's useful to create a view based on another one for the same model without having to duplicate all the view code base or changing the original one by adding invisible conditions or groups to let the original view display without modifications, you will be creating another view, not changing the original one. It's just a feature, you need to find your own scenario to use it

Axel Mendoza
on 7/11/16, 6:45 AM

For example here is an example scenario that could be solved using this feature


Axel Mendoza
on 7/11/16, 6:49 AM

just Saw.. thanks for your reply

on 7/11/16, 8:10 AM

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

2 follower(s)


Asked: 7/11/16, 1:09 AM
Seen: 1716 times
Last updated: 6/8/17, 3:00 AM