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

Pass values of a one2many field to another form?

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
1 Balas
7802 Tampilan
Avatar
Mohammed Roshan

Hi

I have a class

class search_details(osv.osv):

    _description = 'Search Details'

    _name = 'search.details'
    
    def create_file(self, cr, uid, ids, context):
        opportunity_id = self.convert_to_file(cr, uid, ids, context=context)
        return self.pool.get('ip.local').view_file(cr, uid, opportunity_id, context)
    
    def convert_to_file(self, cr, uid, ids, partner_id=False, context=None):
        opportunity = self.pool.get('ip.local')
        for call in self.browse(cr, uid, ids, context=context):  

            class_id = call.classification_no_ids and call.classification_no_ids.id                          

            opportunity_id = opportunity.create(cr, uid, {
                            'classification_no_ids':class_id or False,
                            'search_date': call.search_date or False,
                            'search_slno': call.name,
                        })
       
            vals = {
                'file_no': opportunity_id,
            }
            self.write(cr, uid, [call.id], vals, context=context)

          return opportunity_id


            _columns = {
                        'name' : fields.integer('Sl No', readonly=True),
                        'search_date' : fields.date('Search Date'),             
                        'classification_no_ids' : fields.many2one('classification','Search Class No'),
                        'search_result': fields.one2many('search.name','name','Search Name'),
                        'file_no': fields.many2one ('ip.local', 'File No', readonly=True),
                        }

 

And i used a button create_file to createa new file in ip.local

What am trying is, to pass values from search.details to ip.local

am able to pass values of many2one,date and other kind of fields.

What am stuck with is l cannot pass the value in search_result which is an one2many field

How can i do it?

Please help

 

0
Avatar
Buang
Avatar
Emanuel Cino
Jawaban Terbai

If your class 'ip.local' has also a search_result field which is also of type one2many, you would do this the following:

 opportunity_id = opportunity.create(cr, uid, {
    'classification_no_ids':class_id or False,
    'search_date': call.search_date or False,
    'search_slno': call.name,
    'search_result': [(6, 0, [sr.id for sr in call.search_result])]

})

[(6, 0, ids)] is the standard way in Odoo to write into one2many fields.

1
Avatar
Buang
Mohammed Roshan
Penulis

thank you very much my friend

Mohammed Roshan
Penulis

it worked FANTASTICALLY

Mohammed Roshan
Penulis

Can you just tel me the link to get docs regarding this

Emanuel Cino

You can look this post for reference, but I cannot see where it is in documentation (Odoo is sometimes poorly documented) : https://www.odoo.com/forum/help-1/question/how-to-insert-value-to-a-one2many-field-in-table-with-create-method-28714

Mohammed Roshan
Penulis

Jst found a problem, the data is passing to other screen , its fine. But now the actual data gets deleted. How can i solve this?

Emanuel Cino

Ok, I am sorry I made a mistake in my answer. I will edit when we find the correct solution. Can you try with [(4, sr.id) for sr in call.search_result] instead of what I told you ?

Emanuel Cino

Or maybe the problem can come because of how you declare your field search_result : can you show me how it is declared in object ip.local ?

Menikmati diskusi? Jangan hanya membaca, ikuti!

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

Daftar
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