İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

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

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

Inheriting a view without overriding the original view [SOLVED]

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
viewsinheritanceoverrideodoo8
5 Cevaplar
58875 Görünümler
Avatar
Pepiño

Hi Odoo developers,

I would like to create a view inheriting from another view to remove some elements by using xpath expressions, but I don't want to modify the original view.

The view's code:

    <record model="ir.ui.view" id="email_compose_message_wizard_form2">
<field name="name">mi_new_view</field>
<field name="model">mail.compose.message</field>
<field name="inherit_id" ref="mail.email_compose_message_wizard_form"/>
<field name="arch" type="xml">
<xpath expr="//span[contains(.,'Followers of the document and')]"
position="replace"/>
</field>
</record>

The original view is "mail.email_compose_message_wizard_form".

My view inherits from the "mail.email_compose_message_wizard_form" view, deleting one span element.
I need that my view has all the elements from the original view except one span element.

The problem is that this span element is also deleted from the original view, and I don't want to get this.

How can I achieve this without modifying the original view?.

Thanks for your help.

EDIT (THE SOLUTION):

Thanks to Pedro Manuel Baeza for your solution in the openerp-span google group (https://groups.google.com/forum/#!topic/openerp-spain/ndfXfeFihjA)

The solution is to add 

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

in the inheriting view:

    <record model="ir.ui.view" id="email_compose_message_wizard_form2">
<field name="name">mi_new_view</field>
<field name="model">mail.compose.message</field>
<field name="inherit_id" ref="mail.email_compose_message_wizard_form"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//span[contains(.,'Followers of the document and')]"
position="replace"/>
</field>
</record>

12
Avatar
Vazgeç
Avatar
Niyas Raphy (Walnut Software Solutions)
En İyi Yanıt

Hi,

For this you just need to inherit the original view and set the mode as primary , which will be a working as a new view from the inherited view, along with the changes applied here.

Sample:

<record id="ir_cron_view_form" model="ir.ui.view">
<field name="name">ir.cron.view.form</field>
<field name="model">ir.cron</field>
<field name="mode">primary</field>
<field name="inherit_id" ref="base.view_server_action_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='create_action']" position="replace">
<button name="method_direct_trigger" type="object" string="Run Manually" class="oe_highlight" attrs="{'invisible': [('state', '!=', 'code')]}"/>
</xpath>
</field>
</record>

Reference:

  1. How To Inherit And Create New Report In Odoo

  2. Apply Changes In A View For Particular User Groups In Odoo

  3. How To Inherit Views

Thanks

3
Avatar
Vazgeç
Avatar
Herbert Van de Poel
En İyi Yanıt

For those non-developers out there, this is the way I solve this in Odoo online v15 without XML or dev skills:

Let's say I have a view A (standard Odoo view), and I want to create a new view B building on top of A.

To achieve the desired outcome where View B is modified based on View A without altering View A, you should select "Base View" in the "View Inheritance Mode" when using the Odoo configuration menu to duplicate the view.

Here's the correct process:

  1. Go to "Settings" in the main menu of Odoo.

  2. Under the "Technical" section, click on "Views" to access the view configuration.

  3. Locate View A in the list of views and click on it to open the view configuration form.

  4. In the form, click on the "Duplicate" button (or a similar option) to create a duplicate of View A.

  5. Modify the necessary details of the duplicated view, such as the name and any other attributes specific to View B.

  6. In the "View Inheritance Mode" field, select "Base View" from the dropdown menu.

By selecting "Base View" as the view inheritance mode, you indicate that View B is based on View A and any modifications made to View B will not alter View A.

  1. Save the changes.

Following these steps, you have created View B based on View A using the duplication feature in the Odoo configuration menu. The "Base View" inheritance mode ensures that any modifications made to View B will not affect View A.


2
Avatar
Vazgeç
Anton

When changing to "Base View", which view form do i have to set this? in View A? Because when i set it to View B, it didn't work.

Avatar
Emipro Technologies Pvt. Ltd.
En İyi Yanıt

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.


0
Avatar
Vazgeç
Pepiño
Üretici

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.

Avatar
Sehrish
En İyi Yanıt

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

    
        
            res.group.form.view.inherited
            res.groups
            
            
            
            

                
                    
                                
                
                
                    
                        

                                           
        
    
  

You can get more detail about inheritance from below link:

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

0
Avatar
Vazgeç
Avatar
Ahmed Badawi
En İyi Yanıt

how u solved it ?

0
Avatar
Vazgeç
Ahmed Badawi

thanks - soulation under your question

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

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

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
View inheritance hiding a field
views inheritance
Avatar
Avatar
1
Kas 24
2562
Change the Position of field in Xpath Çözüldü
views inheritance
Avatar
Avatar
Avatar
Avatar
Avatar
5
Tem 24
95723
How to extend a base template for a specific page only, without affecting other pages that use the same base template?
views inheritance
Avatar
Avatar
1
Ara 23
3975
removing elements from an inherited view
views inheritance
Avatar
Avatar
1
May 22
5003
I am building a custom module that has a dependent module that has extended the base view of res_partner. In my custom module I also have an inherited view of the base res_partner view. In it how do I hide the inherited view of my dependent module?
views inheritance
Avatar
0
Oca 20
3486
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

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