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

Add boolean field to Expense line

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
hrxmlviewexpense
2 Cevaplar
8785 Görünümler
Avatar
Paul Strinati

I'm trying to add a boolean field to the expense line in hr.expense, but am struggling to find the relevant object and view names in Developer mode. I'm doing it as a custom module, but need some help with the onetomany relationship between hr.expense.expense, and hr.expense.line (i.e. I cannot figure out the view that I need to edit for the line item).

Basically I just want to add the boolen field at the end of the line (i.e. after the total field) - any pointers greatly appreciated!

This is the XML I'm using in the custom module:


<?xml version="1.0" encoding="utf-8"?>
<openerp>
  <data>
    <record model="ir.ui.view" id="ocl_hr_expense">
      <field name="name">hr.expense.line.tree</field>
      <field name="model">hr.expense.line</field>
      <field name="inherit_id" ref="hr_expense.hr_expense_form_view" />
      <field name="arch" type="xml">
        <xpath expr="//page[@string='Description']/field[@name='line_ids']/tree[@string='Expense Lines']/field[@name='total_amount']" position="after">
          <field name="abc" />
        </xpath>
      </field>
    </record>
  </data>
</openerp>

and my boolean field is defined as follows:

from openerp.osv import fields, osv

class ocl_hr_expense(osv.osv):

    _inherit = "hr.expense.line"

    _columns = {
        'abc': fields.boolean('ABC Reportable')
    }

    _defaults ={
        'abc': 0
    }

ocl_hr_expense()

0
Avatar
Vazgeç
Avatar
Paul Strinati
Üretici En İyi Yanıt

Solution - I was using the wrong model - I should have been using hr.expense.expense instead of hr.expense.line (I assumed because I wanted to add something to the line, I should use hr.expense.line - duh!). So my XML file is now:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
  <data>
    <record model="ir.ui.view" id="ocl_hr_expense">
      <field name="name">hr.expense.line.tree</field>
      <field name="model">hr.expense.expense</field>
      <field name="inherit_id" ref="hr_expense.view_expenses_form" />
      <field name="arch" type="xml">
        <xpath expr="/form/sheet/notebook/page[@string='Description']/field[@name='line_ids']/tree[@string='Expense Lines']/field[@name='name']" position="after">
          <field name="abc" />
        </xpath>
      </field>
    </record>
  </data>
</openerp>

and it works a dream!

 

2
Avatar
Vazgeç
Ludo - 21South

Try adding two slashes instead of just one between all the elements in your xpath. So like: "//page[@string='Description']//field[@name='line_ids']//tree[@string='Expense Lines']//field[@name='total_amount']"

Paul Strinati
Üretici

Thanks but I still get the validation error as above.

Ludo - 21South

Around the error should be the exact part the XML is failing on. For example "Field X could not be found on view for Y". Could you update your issue with said error?

Paul Strinati
Üretici

I've checked the openerp-server.log file and found this: openerp.osv.orm: Can't find field 'message_follower_ids' in the following view parts composing the view of object model 'hr.expense.expense': * hr.expense.form Either you wrongly customized this view, or some modules bringing those views are not compatible with your current data model

Paul Strinati
Üretici

I've re-posted my solution as I've now got it working :)

Ludo - 21South

Good! and thnx for sharing the solution.

Avatar
Anand Patel
En İyi Yanıt

Hi,

you need to add boolean field in r.expense.line and then you have to inherit the hr.expense.expense form view and put that filed by xpath like example given below
<xpath expr="//page[@string='Order Lines']/field[@name='order_line']/tree[@string='Sales Order Lines']/field[@name='product_id']" position="after">

<field name="your_booleans_field" />

</xpath>

0
Avatar
Vazgeç
Paul Strinati
Üretici

Thanks Anand - I've created the boolean field in hr.expense.line, but it's the view name and xpath I'm struggling with as I cannot seem to construct the correct string. I'm trying this: hr.expense.line.tree hr.expense.line But it doesn't seem to like the view name: ValueError: No such external ID currently defined in the system: hr_expense.hr_expense_view and I cannot seem to find the correct view name anywhere. I was trying to work off this one: https://github.com/vnc-biz/openerp-addons-bundle/blob/master-7.0/hr_expense/hr_expense_view.xml

OdooBot
Hi,

when you activate developer mode on the top of the form you will find one drop-down shown in the attached image(developer_mode.png)
from there you will find option for the "edit form view"
there you will find (external_id.png) so take that value and pass it in the xpath



On Mon, Oct 13, 2014 at 1:29 PM, Paul Strinati <paul.strinati@optimumcredit.co.uk> wrote:

Thanks Anand - I've created the boolean field in hr.expense.line, but it's the view name and xpath I'm struggling with as I cannot seem to construct the correct string. I'm trying this: hr.expense.line.tree hr.expense.line But it doesn't seem to like the view name: ValueError: No such external ID currently defined in the system: hr_expense.hr_expense_view and I cannot seem to find the correct view name anywhere. I was trying to work off this one: https://github.com/vnc-biz/openerp-addons-bundle/blob/master-7.0/hr_expense/hr_expense_view.xml

--
Paul Strinati
Sent by OpenERP S.A. using Odoo about Forum Post False



--
Thanks,

Anand Patel
+91 9601663735

Paul Strinati
Üretici

Thanks Anand - I've got the correct External ID now (hr_expense.view_expenses_form), but am now getting a weird error message in the log to do with the parsing of the XML: openerp.osv.orm: Can't find field 'message_follower_ids' in the following view parts composing the view of object model 'hr.expense.expense': * hr.expense.form Some kind of inheritance issue?

OdooBot
Hi,

you need to add following code to the python file.
_inherit = ['mail.thread']

On Mon, Oct 13, 2014 at 5:13 PM, Paul Strinati <paul.strinati@optimumcredit.co.uk> wrote:

Thanks Anand - I've got the correct External ID now (hr_expense.view_expenses_form), but am now getting a weird error message in the log to do with the parsing of the XML: openerp.osv.orm: Can't find field 'message_follower_ids' in the following view parts composing the view of object model 'hr.expense.expense': * hr.expense.form Some kind of inheritance issue?

--
Paul Strinati
Sent by OpenERP S.A. using Odoo about Forum Post False



--
Thanks,

Anand Patel
+91 9601663735

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
How do I remove a button from the sale.order.form? Çözüldü
xml view
Avatar
Avatar
Avatar
Avatar
Avatar
6
Eyl 17
9507
display view if user is anonymous
xml view
Avatar
Avatar
1
Mar 15
5251
How do I change default text from a module view?
xml view
Avatar
Avatar
1
Mar 15
7015
XML from module not loaded after changes.
xml view
Avatar
Avatar
2
Mar 15
10986
view xml, attrs use variable with attribute Çözüldü
attrs xml view
Avatar
Avatar
1
Mar 24
11637
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