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

Access an object field from another object

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
newmodule
1 Cevapla
4472 Görünümler
Avatar
Pau Ubach

I have the following situation: 

An object A has a view with a field many2one of the object B, and B has a many2one of the object C.

A also has a related field A1 which displays a field (C1) in the object C, but we can select its value directly in A view.

I can select an existing B or create a new one. The same with C.

When I select to create new B and C I get the form view for the new object C. 

 

How can I set the value in C1 to be equal to A1?

 

I'm trying with:

def default_get(self, cr, uid, fields, context=None):
            _logger.info('Inside bdd_project.default_get')
            if context is None:
                context = {}
            res = super(bdd_project, self).default_get(cr, uid, fields, context=context)
            pl_obj = self.pool.get('bdd.pricelist')
            pl = pl_obj.browse(cr, uid, context.get('cus_id'), context=context)
            if 'cus_id' in fields:
                _logger.info('Inside if cus_id: value %s', pl.cus_id)
                res.update({'cus_id': pl.cus_id})
            return res

 

where bdd_project would represent the object C and bdd_pricelist would be A.

pl.cus_id is returning None.

0
Avatar
Vazgeç
Avatar
Ivan
En İyi Yanıt

Pau, the notion of having a related field means that you SHOULD NOT edit the value directly.  If you want to sync C1 with the value of A1 which is selected by User, then you should not define A1 as a related field, but define it as a normal field.

Then you on write (or create) of A, you can update the related C1 field value based on the value set by user.

0
Avatar
Vazgeç
Pau Ubach
Üretici

The normal flow should be from C to A, I mean that C1 should be already defined when the view A is opened, and that's why it's a related field. But there's a rare scenario where an user could want start defining from A to C, and that's why I need to implement it this way.

Ivan

Pau, even if it is a rare chance, you still need to implement the synchronization, i.e. change A1 if C1 is updated and C1 if A1 is updated. You still can default A1 to display whatever value C1 is holding. Another approach that you may want to consider is to display B in A's form and C in B's form, hence user can change C1 from C's form instead of changing it from A's form. More longwinded for user, I understand.

Pau Ubach
Üretici

John, what do you mean by implement the synchronization? Do you have a link to any document explaining how to do it? The request is to display C1 in A, and then filter B by this value.

Ivan

Pau, your first problem description is that user need to be able to change A1 and then C1 need to be change to be equal to A1. Does this still a requirement? If so, my answer stands. Synchronization is basically changing C1 when A1 is changed by user and A1 if C1 is selected by user. You need to inherit method write of both class A and C. For, say class A, you need to detect if there is any change in A1, and then change the related C1 value to be the same as A1, vv. If your first problem description is not correct, then I would suggest that you restate what you really need so the answer can be crafted more accurately.

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 to debug view XML when openerp doesn't say anything about it? Çözüldü
newmodule
Avatar
Avatar
Avatar
2
Mar 15
8703
Adding new modules in OpenERP
newmodule
Avatar
Avatar
2
Mar 15
4404
Integrity Error with calendar.event module
newmodule
Avatar
0
Mar 15
4306
Display a day in a schedule for a period
newmodule
Avatar
0
Mar 15
4702
MRP module installed, but not available in the home screen Çözüldü
mrp newmodule
Avatar
Avatar
1
Haz 16
4629
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