Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

I don't understand the basic concepts of related fields in Odoo/OpenERP 7.0 - can someone help with examples?

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
openerp7
4 Replies
13537 Tampilan
Avatar
Karthik Arumugam

Please help me to understand the basic concepts of releated field in openerp 7.0 with simple examples

1
Avatar
Buang
Avatar
Axel Mendoza
Jawaban Terbai

A related is simply a function field capable to retrieve by itself values from relations models, typically from many2one relation models, for this you need to specify the path to the field in the target model that you want to access using the related field. This path is in the form of a sequence of arguments for the constructor of field at the begining, the rest of the arguments that not are part of the path need to be named arguments. As every function field the related need to specify it's type and in the case when the target type is a relation one like many2one, one2many or many2many, you need to specify of the relation named value with the target model of the relation. Take this examples, we will create related fields to access fields through many2one relations of the models:

class res_example1(osv.osv):
_name = 'res.example1'
_columns = {
'name': fields.char('Name', size=64),
'code': fields.char('Code', size=64),
'value': fields.float('Value'),
}
res_example1()

class res_example2(osv.osv): 
_name = 'res.example2'
_columns = {
'name': fields.char('Name', size=64),
'example_id': fields.many2one('res.example1', string='Example 1'),
'code_example': fields.related('example_id', 'code', type='char', string='Code'),
}
res_example2()

class res_example3(osv.osv): 
_name = 'res.example3'
_columns = {
'name': fields.char('Name', size=64),
'example_id': fields.many2one('res.example2', string='Example 2'),
'value_example': fields.related('example_id', 'example_id', 'value', type='float', string='Value'),
'ref_example': fields.related('example_id', 'example_id', type='many2one', relation='res.example1', string='Example 1'),
}
res_example3()

In res.example2 model the related access to the code field of the res.example1 through it's field example_id, using this path ('example_id', 'code',...) as first parameters in the field definitions. In res.example3 model we have 2 related fields, the value_example is for access the field value in res.example1, note that res.example3 has no direct relation with res.example1, thas why the arguments for path is ('example_id', 'example_id', 'value',...). Using the relation with res.example2 and res.example2 relation with res.example3 is how res.example3 related field value_example have access to the field value of res.example1. The second related in res.example3 is for show how a related to a relation target type can be done, in this case we will map the access to the field example_id in res.example2 so we need to specify the type many2one and the target relation using the relation argument.

Hope this helps

2
Avatar
Buang
Maurice Agée

does it the same in V8 ?

Axel Mendoza

yes, you could do it using the old api or v8 api like:

nickname = fields.Char(related='user_id.partner_id.name')
Avatar
Reinhart
Jawaban Terbai

Axel Mendoza's answer says it all, as an extra a simplified description would be:
* A related field is a link to another field stored in another model, as axel said, usually in a m2o relation field

0
Avatar
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
Error: NameError: name 'field' is not defined
openerp7
Avatar
Avatar
Avatar
2
Mei 22
35091
How to add "meta viewport" tag in OpenERP v7.0?
openerp7
Avatar
0
Mar 19
4934
return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
openerp7
Avatar
0
Jan 19
6100
How to use ternary operator in Open-ERP7 for domain filter in XML ?
openerp7
Avatar
0
Jan 18
4691
How to add calculated field to order.report ?
openerp7
Avatar
0
Sep 17
5323
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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