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

How does the ORM Read() method work exactly?

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
externalintegrationorm
2 Cevaplar
42355 Görünümler
Avatar
Moin

I assumed that the read method returns a list of dictionaries (records) which are then directly displayed by the list view or form view but that does not seem to be the case. I have this very simple python object defined as follows:

class time_periods(osv.osv):

def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
    res = super(time_periods, self).read(cr, uid, ids, fields=fields, context=context, load='_classic_read')
            #res is empty at this point since the underlying table is empty
            #I want to display completely new data (same fields though) in the list view
    res = [{'name': 'Test', 'id':1}, {'name': 'Test 2', 'id':2}]

    print res
    return res

_name = 'time.periods'

_columns = {
    'name': fields.char('Name', size=50),
        }

time_periods()

currently the corresponding table in the OpenERP database is empty but I assumed that the hardcoded list(res) would act as records retrieved from the database however the list view still renders enpty.

As an experiment, I created a record with id = 2, name = "Test" in the database and the tree view showed one record but with name = "Test 2" as defined in the list(res).

The idea is to replace the list(res) with data retrived from an external database through xmlrpc call.

So, how does the read method work exactly?

Thank You.

EDIT

Just to make my problem clearer, the time_periods table in the OpenERP database is empty so the super call to the read method returns an empty list. What I want to do is display data (from another database but with same fields as the python object) in OpenERP even when the local database is empty. So, essentially I want to intercept the data source of the list view and attach my own data in it not simply make changes to existing data since there is no data.

0
Avatar
Vazgeç
Yug Faa

Try to format your code, I think that you're replaced the content of res, use two variables res1 and res2 and display them with print :)

Yug Faa

use res.get(NAME_OF_FIELD) to get values from res

Moin
Üretici

It doesn't matter that I override the content of res since res is an empty list by default (the table is empty) I want to display new records entirely at run time despite there being no data in the OpenERP database.

Sehrish

Hope this will helps: https://learnopenerp.blogspot.com/2021/09/restrict-user-to-access-differnt-records-by-changing-id-in-url-odoo.html

Avatar
Yohanes Iwan Sugiarto
En İyi Yanıt

Hi Moin!

Here is a simple example to demonstrate the read method. Just for demonstration sake, this code will add triple asterisks '***' in front of the name field of product_category field.

You can replace line 8 with another code to replace the value from another database.

def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
    if context is None:
        context = {}
    res = super(product_category, self).read(cr, uid, ids, fields=fields, context=context, load=load)
    idx = 0
    for r in res:
        if r.has_key('name'):
            r['name'] = '***' + r['name']
            #replace line above with replacement value from external database
        res[idx] = r
        idx = idx + 1
    return res
1
Avatar
Vazgeç
Moin
Üretici

Thanks for your answer Yohanes, although I think I may have not described my problem correctly. See the EDIT for clarification please. Thank you again for your time.

priyankahdp

thanks Iwan.. any idea about this issue ? http://help.openerp.com/question/8391/how-to-load-child-records-to-fields/

Avatar
Noel Jesús Rivero
En İyi Yanıt

Hello , I'm having the same problem. I can't find a way to do this. Do you have a solution?
 

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
Integration from Rails
external integration
Avatar
Avatar
1
Tem 17
6139
Integrate external VoIP server.
external integration voip
Avatar
0
Şub 24
2460
Connecting two Odoo instances Çözüldü
security external integration internal
Avatar
Avatar
Avatar
Avatar
3
Eki 24
9378
Is it possible to integrate Webflow into Odoo? If yes, is there any documentation on this?
integration
Avatar
Avatar
1
Kas 25
7087
is the odoo API integration available for odoo cloud edition? Çözüldü
integration
Avatar
Avatar
Avatar
Avatar
3
Ağu 25
5328
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