Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

Inheriting views override the original one

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
odoo8.0
7 Réponses
21684 Vues
Avatar
kawtar elz

Hello, 

I have created a module in odoo, and the original views have changed, now I want to create an other module that can inherits the original views, I tried <field name=" mode">primary</field> but I got only the original view, no changes. Plz help me

0
Avatar
Ignorer
Sehrish

Inheritance in model and views: https://goo.gl/4Zyc9d

Avatar
Muhammad Faizal NS
Meilleure réponse

When you create a new module and if you want to inherit the fields in the basic view you need to call the reference of the form view.

<field name=”inherit_id” ref=”module_name.id_of_form_view”/>​​​

Example:



<record id="move_form_view" model="ir.ui.view">
<field name="name">move_form_view</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_quotation_send']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>
4
Avatar
Ignorer
Avatar
Mohammed Amal N
Meilleure réponse

hello,

you can use :

<field name=”inherit_id” ref=”module_name.id_of view”/>

here is a simple example to inherit sale order form view :

<record model=”ir.ui.view” id=”sale_order_custom_field”>
    <field name=”name”>sale.order.form</field>
    <field name=”model”>sale.order</field>
    <field name=”inherit_id” ref=”sale.view_order_form”/>
    <field name=”arch” type=”xml”>
        <xpath expr=”//field[@name='partner_id']” position=”after”>
            <field name=”sale_project_ids”/>
        </xpath>
</field>
</record>

4
Avatar
Ignorer
Avatar
Nikhil Krishnan
Meilleure réponse

Hi,
If you create a module with name A, and you inherit its form view by
<field name=”inherit_id” ref=”mrp.mrp_production_form_view”/>
after inheriting it you change the form view as you like, Mr. Amal already provide a perfect code.

<record id="mrp_production_form_view_inherits" model="ir.ui.view">
 <field name="name">mrp.production.form</field>
 <field name="model">mrp.production</field>
<field name=”inherit_id” ref=”mrp.mrp_production_form_view”/>
<field name="arch" type="xml">
.........................................................................
.........................................................................
</field> 

 After that you want it create a new module with name B. and you want Inherit the same form and view, then 

<field name=”inherit_id” ref=”A.mrp_production_form_view_inherts”/>

Don't forget to add the dependancy in manifest file

'depends': ['mrp', 'A',],

thanks
0
Avatar
Ignorer
Avatar
Raaj Mishra
Meilleure réponse

Hi Kawtar, if you want to inherit your original view, then in that case you need to add a field attribute called as inherit_id to your inherited view.

A = module_name_where_you_define_original_view [for understanding]

B = original_view_id [for understanding]                                                           

Syntax : <field name="inherit_id" ref="A.B"/>

0
Avatar
Ignorer
Avatar
kawtar elz
Auteur Meilleure réponse

I have already created a module on odoo and this module inherits several views, these views have changed when I modified their content. Now I want to create a new module that inherits the original views but I can't access the original views. what shoud I do ? The content of the original views has changed completely

0
Avatar
Ignorer
Avatar
Sehrish
Meilleure réponse

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:

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

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

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


To model inheritance:

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

Get complete code about view and model inheritance with description

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



0
Avatar
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
how to implement joint piece in odoo 8 in one view
odoo8.0
Avatar
0
avr. 24
2653
what is the reason behind extra move? in stock
odoo8.0
Avatar
Avatar
Avatar
Avatar
4
nov. 23
6843
How to solve fields.function issue in odoo 8
odoo8.0
Avatar
0
oct. 23
2659
how to restrict create and delete access in one2many field tree view
odoo8.0
Avatar
0
déc. 22
3372
odoo8 How to pass parameters in the URL ? Résolu
odoo8.0
Avatar
Avatar
Avatar
2
déc. 23
20700
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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