Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

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

Subscribe

Get notified when there's activity on this post

This question has been flagged
2 Replies
20247 Views
Avatar
Annadurai

how it  works? and it's usages?

7
Avatar
Discard
Annadurai
Author

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

Avatar
Axel Mendoza
Best Answer

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">

<sheet>

<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">

<h2>

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

</h2>

</div>

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

</div>

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

</button>

</div>

<div class="oe_clear"/>

<notebook>

<page string="Personal Information">

<group>

<field name="marital_status"/>

<field name="religion"/>

<field name="ethnic_group"/>

</group>

<label for="comments"/>

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

</page>

</notebook>

</sheet>

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

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

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

</div>

</form>

</field>

</record>

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

</page>

</xpath>

</field>

</record>


7
Avatar
Discard
Annadurai
Author

thank for ur reply Axel.. :)

Annadurai
Author

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..

Annadurai
Author

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

Axel Mendoza

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

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

https://www.odoo.com/es_ES/forum/ayuda-1/question/inherited-product-module-in-our-custom-module-104620

Annadurai
Author

just Saw.. thanks for your reply

Avatar
Srushti
Best Answer

but can we inherit the record that has set to primary mode and customize it


MI PIACE IL PEPPER!

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now