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

Get the ticket ID (& title) inside python - raise ValueError

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
2 Cevaplar
3023 Görünümler
Avatar
Lukas Schreiber

Hi,

I'm trying to customize a python code within Odoo V12 which is passing details from an ticket into a bill.

This is working so far (not coded by myself):

def _prepare_invoice_line_details(self, line, desc_rule):
        details = []
        if desc_rule[0] == '1':
            employee=self.env['hr.employee'].search([('id','=',line.employee_id.id)])
            details.append("\n" + employee.name)
            details.append(datetime.strftime(datetime.strptime(fields.Date.to_string(line.date), '%Y-%m-%d'), '%d.%m.%Y'))
        if desc_rule[1] == '1':
            details.append("%s %s" % (line.unit_amount, line.product_uom_id.name))
            details.append(line.x_studio_ort_der_leistungserbringung)
        if desc_rule[2] == '1':
            details.append(line.x_studio_zeitraum + "\n" + line.name)
        return details

...
...
...


It's almost the same as here: https://code.compassfoundation.io/odoo/care_center/blob/ba5b4ee9d15f9dcf070bdde808c0eae7add1db9e/care_center_timesheets/models/sale_order.py with just some additional values.

It's just collecting the information from an ticket within the description columns and passing it to the billing process.
Now I have added 2 additional columns and they should also be passed to this function. I have added these 2 fields with the studio manager which was quite simple and also the first field was quite easy to handle by adding this:

details.append(line.x_studio_abrechnungsart)

But with the other column I'm struggling.
It's a related field which is actually just the Ticket title + ID:


I can't attach an screenshot, so I'm trying to "draw" it:

----------------------------------------------------------------------------------------
date | employee | description | billing type | ticket | duration |

21.04.20 | Gerad | broken login data | goodwill | Test Ticket (#1620) | 0:30

----------------------------------------------------------------------------------------

(so it's regarding the fat formatted, billing type I was able to do by myself, unfortunately "ticket" (underlined) I wasn't able) 

Note: This filed will later be marked as invisible, I just abuse the field because I thought it will be much more easier to get the needed value because I can use following line as an template:

employee=self.env['hr.employee'].search([('id','=',line.employee_id.id)])

So I have tried to do the following:

helpid=self.env['helpdesk.ticket'].search([('helpdesk_ticket_id','=',line.helpdesk_ticket_id.id)])
details.append(helpid)

But now, when I try to generate the bill, I'm receiving this error message:

raise ValueError("Invalid field %r in leaf %r" % (left, str(leaf)))
ValueError: Invalid field 'helpdesk_ticket_id' in leaf "<osv.ExtendedLeaf: ('helpdesk_ticket_id', '=', 1620) on helpdesk_ticket (ctx: )>"

As you can see there is the correct Ticket-ID (1620) but I wasn't able to fix this.

Additional information: It would also be no problem to get the Ticket ID anyway else, as already mentioned I only abusing this extra column to display the ticket title + ID.

It would be also great if also the ticket-title (in the example "test ticket") will be fetched and not only the ID (1620 in the example), but if not it's also ok.


Can somebody please assist and tell me what I'm doing wrong here?


Best regards.

0
Avatar
Vazgeç
Avatar
Lukas Schreiber
Üretici En İyi Yanıt

Hi,

thanks for the answer. 
Ahh, yeah sure, I don't have helpdesk_ticket_id inside the helpdesk.ticket model.

I have changed it. This is working now. Thank you.

For the Title / Ticket-name I would need to fetch another field as I can comprehend?
(Not important but may interesting to add this in the future)

Best regards. 

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

Hi,

Did you have a field named helpdesk_ticket_id inside the helpdesk.ticket model ? If not that is why you are getting the error. 

It seems you have wrongly given it instead of id .

helpid=self.env['helpdesk.ticket'].search([('helpdesk_ticket_id','=',line.helpdesk_ticket_id.id)])

Change the above line of code to as follows and see,

helpid=self.env['helpdesk.ticket'].search([('id','=',line.helpdesk_ticket_id.id)])


Thanks

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