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

Prevent record creation in computed One2Many or Mayn2Many in Tree/Kanban field

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
readonlymany2manyinversecomputed
2 Replies
3159 Tampilan
Avatar
Torsten

Hi,

I created a computed Many2Many field. To make it writable, I used the inverted argument to define a reverse function like so:

document_ids = fields.Many2many(..., compute='_compute_document_ids', inverse='_set_document_ids')
def _compute_document_ids(self): ​...
def _set_document_ids(self): ​...

Then I created a view which makes use of this field with a Kanban or Tree element. So far everything works fine, I can read, create and delete documents.


Now I want to have the Kanban not to be able to create or delete records, only to be able to edit records when opening them. So I tried the following attemps, none of them works:

### 1:
field name="document_ids" mode="kanban" options="{'no_create': True}" /> 

### 2:
field name="document_ids" mode="kanban" create="0" />
### 3:
field name="document_ids">
​tree create="0">
​ ...


No matter if I use Kanban/Tree here, I still have the "add" or "add a line" option. When I make the field readonly, then the add/delete options disappear. But when I open the record details, I also cannot edit the (because read only).


What am I missing? I need to have a computed field for showing related Many2Many records, I do not want to be able to add/remove records from the parent record but be able to edit them in detail view by clicking on them.

THX



0
Avatar
Buang
Avatar
Nomadoo
Jawaban Terbai

To achieve your goal of making the Kanban view not able to create or delete records, but still be able to edit them when opening, you can use a combination of the following approaches:


    Make the Field Readonly in Kanban:

    Set the readonly attribute for the document_ids field in the Kanban view to prevent creating or deleting records directly from the Kanban view.


Use a Separate Form View for Editing:

Create a separate form view for editing the records and use it when clicking on a record in the Kanban view. This allows you to control the edit behavior independently.

Then, define a form view for the model where you can customize the behavior as needed.


When clicking on a record in the Kanban view, Odoo will open the form view specified in the model.


Use a Related Field for Display:

If you only need to display related records in the Kanban view and do not require direct editing, you can use a related field for display purposes in the Kanban view.


Then, define a related field in your model. 


    display_document_ids = fields.Many2many(related='document_ids')


    Note: This approach will only allow displaying related records in the Kanban view without the ability to edit them directly.


Choose the approach that best fits your requirements. If you need to customize the editing behavior, creating a separate form view for editing is a flexible solution.

1
Avatar
Buang
Avatar
Torsten
Penulis Jawaban Terbai

Hi. Thanks for your answer. 

According to it I created another view for editing the detail data (in my case Document). Odoo also uses this view correctly to display the detail date and I am also able to edit the record with this view.

But as soon as I make the Many2Many / One2Many field *readonly* in the parent view then the detail data view is also *locked* so that I cannot edit data anymore.

The same result also if I replace the Kanbank Many2Many with a tree.


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
Computed field value stored even when remove line Diselesaikan
many2many computed
Avatar
Avatar
Avatar
2
Apr 24
4739
Computed many2many field dependencies in Odoo 10
many2many computed
Avatar
1
Des 16
8782
How do I make a button invisible if field (m2m) is False? Diselesaikan
many2many computed odoo10
Avatar
Avatar
4
Feb 20
5136
many2many, records/rows readonly
readonly many2many records
Avatar
Avatar
2
Mar 15
10900
Inverse Function ind Odoo 9
treeview inverse odoo9 computed
Avatar
2
Jul 16
519
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