İç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

Help with XPath and View Inheritance

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
viewsfieldsinheritancexpath
4 Cevaplar
70169 Görünümler
Avatar
Bob Berger

Hello,

I am having trouble using XPath to do anything with views. I've read a lot on StackOverflow and Odoo's official documentation about XPath and view inheritance, but I don't understand how to use it because it never seems to work for me. i am using the inventory app. If I use the following in my view, it correctly makes the list_price field invisible

<odoo>
    <data>
        <record id="view_kit_product_form" model="ir.ui.view">
            <field name="name">kit_product_form</field>
            <field name="model">product.template</field>
            <field name="inherit_id" ref="product.product_template_form_view"/>
                     <field name="arch" type="xml">                             
                        <field name="list_price" position="attributes">
                            <attribute name="invisible">True</attribute>
                        </field>                    
                     </field>
        </record>
    </data>
</odoo>

but replacing

<field name="list_price" position="attributes">
      <attribute name="invisible">True</attribute>
</field>

with

<xpath expr="/form/sheet/notebook/page/group/group/field[name='list_price']" position="attributes">
    <attribute name="invisible">True</attribute>
</xpath>

or

<xpath expr="//field[@name='list_price']" position="attributes">
<attribute name="invisible">True</attribute>
</xpath>

or

<xpath expr="field[@name='list_price']" position="attributes">
<attribute name="invisible">True</attribute>
</xpath>

will always cause an error which creates a server error and tells me this:

Element '<xpath expr="field[@name=list_price]">' cannot be located in parent view.

In fact, trying to do anything with XPath has given me this error, and I don't understand why.

Shouldn't

<xpath expr="field[@name='list_price']"/>

Do the same thing as

<field name="list_price"/>

?

Can anybody tell me what I'm doing wrong? Or if there are any better resources which explain how to use XPath with Odoo and view inheritance, I would really appreciate it if you could tell me about them! I've seen people say you can use XPath with a view to even hide pages in a notebook in a form, but trying to do that also gives me an error.

Any help would be greatly appreciated

0
Avatar
Vazgeç
Mohammed Amal N

Hi, try this <xpath expr="//page[@name='general_information']/field[@name='list_price']" position="attributes">

Bob Berger
Üretici

That gives the same error:

Element '<xpath expr="//page[@name='general_information']/field[@name='list_price']">' cannot be located in parent view

thompsonn

Shouldn't

<xpath expr="field[@name='list_price']"/>

Do the same thing as

<field name="list_price"/>

?

It shouldn't as you're telling the machine to search on the top level only. Instead, it should be:

<xpath expr="//field[@name='list_price']" position="attributes">

...

</xpath>

But my guess is that you just have missed leading '//' for the second time. I tried your code, it all works fine except for the one without leading '//'. You should probably try checking the spelling.

Bob Berger
Üretici

Thank you thompsonn! You are right, and that is a helpful explanation that it is only searching the top level if you leave out "//"

thompsonn

Posted it as an answer, please don't hesitate to mark it as accepted :) Thanks

Sehrish

Read this: https://goo.gl/fGNfBY

Avatar
thompsonn
En İyi Yanıt
Shouldn't
<xpath expr="field[@name='list_price']"/>
Do the same thing as
<field name="list_price"/>
?

It shouldn't as you're telling the machine to search on the top level only. Instead, it should be:

<xpath expr="//field[@name='list_price']" position="attributes">
...
</xpath>

But my guess is that you just have missed leading '//' for the second time. I tried your code, it all works fine except for the one without leading '//'. You should probably try checking the spelling.

1
Avatar
Vazgeç
Avatar
Sehrish
En İyi Yanıt

Can anybody tell me what I'm doing wrong? Or if there are any better resources which explain how to use XPath with Odoo and view inheritance...
Yes why not I found some useful resources about XPath and inheritance in views and models.
http://learnopenerp.blogspot.com/2018/01/inheritance-in-models-and-views.html
Have a look into hope its helpful for you and others.
Thanks

1
Avatar
Vazgeç
Sehrish

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

Avatar
Ali Raza
En İyi Yanıt

To clearify here, '//field['foofield']' won't work if their ain't any field of name foofield, you'll have to look for element props. If you wanna search for an element in table, use //table['@name='footable']. good luck.

0
Avatar
Vazgeç
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
Extension View - Multiple xpath replacements Çözüldü
views inheritance xpath
Avatar
Avatar
Avatar
2
May 24
3991
How to hide a button that is identified by its action id ?
views inheritance xpath
Avatar
Avatar
Avatar
4
Eyl 20
7091
Replace xpath expr with xpath
views xml inheritance xpath
Avatar
0
Ağu 21
4178
How to add a field in an inherited group? Çözüldü
views fields xpath odoov12
Avatar
Avatar
Avatar
Avatar
5
Ağu 19
10307
[ODOO 10] "Unknown field in domain" error when inheriting a view to add sub-fields
views fields inheritance one2many
Avatar
Avatar
1
Oca 18
8054
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