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

Odoo 10 : Make a specific field of popup window only readable

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
viewsrelationshipreadonlyodoo10
5 Replies
6262 Tampilan
Avatar
Zied Haffoudhi

Hi guys,


I'm stuck here :


<notebook>
<page string="purchase_inquiry_ids">
<!--This is a One2many field relation-->
<field name="purchase_inquiry_ids" context="{'default_purchase_order_id': active_id}"/>
</page>
</notebook>
 


When I click add an item, the purchase_order_id display the current id but I want to add a readonly="1" attribute to this field. 

I really appreciate your help to resolve this.

0
Avatar
Buang
Avatar
Bejaoui Souheil
Jawaban Terbai

Hi,

First, create a new form view for your model where you do all customization needed.

After that use "fields_view_get" for the purchase_inquiry_ids model to return this custom view when your context has "default_purchase_order_id" as a key.

@api.model
def fields_view_get(self, view_id=None, view_type=False, toolbar=False, submenu=False):
     if view_type == 'form' and self.env.context.get('default_purchase_order_id'):
         view_id = "the_custom_view_id"
     return super(YourClass, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu)

Best regards.

1
Avatar
Buang
Avatar
Zied Haffoudhi
Penulis Jawaban Terbai

I tried to simplify the code by inherit the default view of the 'purchase_inquiry' and pass an attribute to a specific field but it lead me up to a blind alley.

I was obligated to follow the long way.

I write the view from scratch and there I customize what I need :


<notebook>
<page string="purchase_inquiry_ids">
<!-- <field name="purchase_inquiry_ids" context="{'default_purchase_order_id': active_id}" options="{'always_reload': True}"/> -->
<field name="purchase_inquiry_ids" context="{'default_purchase_order_id': active_id}">
<form string="Demande d'offre Form">
<header>
<button string="Set to draft" type="object" name="draft_progressbar" attrs="{'invisible': [('state', '=', 'draft')]}"/>
<button string="Sent" type="object" name="sent_progressbar" attrs="{'invisible': [('state','=','sent')]}"/>
<button string="Received" type="object" name="received_progressbar" attrs="{'invisible': [('state','=','received')]}"/>
<button string="Accepted" type="object" name="accepted_progressbar" class="oe_highlight" attrs="{'invisible': [('state','=','accepted')]}"/>
<button string="Refused" type="object" name="refused_progressbar" class="oe_highlight" attrs="{'invisible': [('state','=','refused')]}"/>
<button string="Create Command" type="object" name="create_command" class="oe_highlight" attrs="{'invisible': [('state','!=','accepted')]}"/>
<field name="state" widget="statusbar" statusbar_visible="draft, sent, received, accepted, refused"/>
</header>
<sheet>
<group>
<field name="name"/>
<field name="purchase_order_id" readonly="1"/>
<field name="provider_id"/>
<field name="date_inquiry"/>
<field name="datefinal_inquiry"/>
</group>
<group col="6">
<field name="product" placeholder="Product Name"/>
<field name="qte" placeholder="Nbr Emballage"/>
<field name="qte_total_unity" placeholder="Qte Totale"/>
</group>
<notebook>
<page string="Informations">
<group>
<field name="price"/>
</group>
</page>
<page string="Description">
<label for="description" string="Description"/>
<field name="description"/>
</page>
</notebook>
</sheet>
</form>
</field>
</page>
</notebook>



0
Avatar
Buang
Avatar
Mohammed Amal N
Jawaban Terbai

You can give readonly="1" for a one2many field

just add

<field name="purchase_inquiry_ids" readonly="1" context="{'default_purchase_order_id': active_id}"/>


0
Avatar
Buang
Zied Haffoudhi
Penulis

Thank you for your reply Mohamed.

Readonly="1" there disable the possibility to create other record by clicking 'add an item'.

I want to display the popup to create another purchase_inquiry record using the current purchase_order id and I would like in this inherited form the purchase_order_id be disabled or readonly.

Mohammed Amal N

I didn't clearly understand what you are trying to say,

but if you want to add some thing to your one2many and make fields in its view readonly try this:

<field name='your_one2many'>

<tree>

<field name='field1_in_the_one2many_model' readonly='1'/>

<field name='field2> readonly='1'/>

</tree>

</field>

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
How to have 2 lists for the same relation field in a form view?
views relationship odoo10
Avatar
0
Mar 19
3922
odoo 10 : form for picking with only one field
views odoo10
Avatar
Avatar
Avatar
2
Des 19
3733
How to hide fields in the create and edit popup view?
views odoo10
Avatar
0
Nov 18
3874
Make readonly start_date, end_date from sale order view Diselesaikan
views readonly sale.order.form
Avatar
Avatar
Avatar
2
Agu 25
1324
[Odoo 10] what is the best way to duplicate an existing view? Diselesaikan
views xml odoo10
Avatar
Avatar
Avatar
2
Nov 23
8305
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