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

How do I select the parent record automatically when I open the form-view created by a one2 many relationship?

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
one2manyformviewone2many_listodoo12
1 Balas
5587 Tampilan
Avatar
Simone

I extended res_partner and linked to a "unique code" model like this:

Partner Model :

class Partner(models.Model): _inherit='res.partner'... anagrafiche_codiceunivoco_ids = fields.One2many('utilitypower.codiceunivoco','id_anagrafica',string ='Anagrafica Codice Univoco')

CodiceUnivoco model:

class CodiceUnivoco(models.Model): _name ='utilitypower.codiceunivoco' _description = 'Codice Univoco' codice = fields.Char('Codice Univoco',required=True) id_anagrafica = fields.Many2one('res.partner', string='Cliente')

Res_partner view :

<xpath expr="//notebook" position="inside">  <page name="codice_univoco" string="Codice Univoco"> <field name="anagrafiche_codiceunivoco_ids" string="Codice Univoco" widget="one2many_list" >  <tree> <field name="codice"></field> </tree> </field> </page>

codiceunivoco_view :

<record id="view_form_codiceunivoco" model="ir.ui.view">  <field name="name">Codice Univoco Form</field>  <field name="model">utilitypower.codiceunivoco</field> <field name="arch" type="xml">  <form string="Codice Univoco"> <header></header> <sheet> <group> <field name="codice"></field> <field name="id_anagrafica" widget="man2one_list" /> </group> </sheet> </form> </field> </record>

what I want is that when from the res_partner view I add a record to "univocal code" (via widget one2many_list) and the module view of "univocal code" opens, the record with the client is set with the one from which I opened the module or in alternatively the customer field is hidden.

How can i do this?

0
Avatar
Buang
Avatar
faOtools
Jawaban Terbai

One2many already adds by default an active partner into the field id_anagrafica. It is done as soon as you save a partner (no when you add a line). In order to show a partner right when you press 'Add a line', add to your field a context:

<field name="anagrafiche_codiceunivoco_ids" context="{'default_id_anagrafica': active_id}"/>

 Hiding a related partner might be also reasonable, since it anyway would be saved. To that end:

<field name="id_anagrafica" invisible="1"/>



1
Avatar
Buang
Simone
Penulis

thank you for your answer, i tried your first solution and let me know if i correctly understand :

with context i know that i can pass some informations and in this case with default_fieldname we try to set the default value, active_id i guess that is the active id of the partner from wich we open the insert form of a "codiceunivoco".

so in res_partner form_extended view i added:

<field name="anagrafiche_codiceunivoco_ids" string="Codice Univoco" widget="one2many_list" context="{'default_id_anagrafica': active_id}">

<tree>

<field name="codice"></field>

</tree>

</field>

but when i click to add line the many2one_list in "codiceunivoco" form view doesn't have the client selected.

For the second option i forgot to explaine that i have to hide the field when is called by the partner form but it must be visible when the "codiceunivoco" form view is called by another menu_action.

I think that i can do this with context or domain in id_anagrafica but i can't find how to have the partner_id.

Simone
Penulis

First option is exactly what i want, thank you for your answer.

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
Access One2many fields values?
one2many odoo12
Avatar
Avatar
1
Sep 23
4424
form view was changed when reloading the page
formview odoo12
Avatar
Avatar
2
Jul 22
1494
The operation cannot be completed: - Create/update: a mandatory field is not set. - Delete: another model requires the record being deleted. If possible, archive it instead. Model: Pemesanan Bahan Detail (restaurant.pemesanan_bahan_detail), Field: Bahan (bahan_id
one2many odoo12
Avatar
Avatar
1
Sep 21
27651
tree view for one2Many not populating
one2many one2many_list
Avatar
Avatar
2
Okt 20
3850
Odoo Server Error Expected singleton: gc.level(24, 25) for One2many field Diselesaikan
one2many odoo12
Avatar
Avatar
Avatar
2
Jul 20
4846
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