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

[SOLVED] How can I change the popup form which a function field generates?

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
1 Balas
8239 Tampilan
Avatar
Juan Formoso Vasco

I have created a new model, called res.partner.link.category, whose fields are: active_category, partner_id, link_category_id, type, date and observations.

And in the model res.partner, I added a new field (a function of type many2many pointing to the new model I have created). Here the Python code:

'history': fields.function(_get_history, type='many2many',
                            obj="res.partner.link.category",
                            method=True, string='Categories'),

Then, I want to show it in the res.partner form, as a list of records, so I added this code to the XML of res.partner form:

<group>
    <field name="history" nolabel="1">
        <tree string="Categories">
            <field name="active_category"/>
            <field name="link_category_id"/>
            <field name="type"/>
            <field name="date"/>
            <field name="observations"/>
        </tree>
    </field>
</group>

It works great. Note that I do not show the field partner_id inside the tree, and in fact it is not being shown, so perfect. But, if I click on any record of the tree, a popup form is opened, with all the fields of res.partner.link.category, including partner_id, which I do not want!

So I would like to know how to modify that form (I tried to create the next customized form for res.partner.link.category):

<record id="res_partner_link_category_view" model="ir.ui.view">
    <field name="name">res.partner.link.category.form</field>
    <field name="model">res.partner.link.category</field>   
    <field name="type">form</field>
    <field name="arch" type="xml">
        <group>
            <field name="active_category"/>
            <field name="link_category_id"/>
            <field name="type"/>
        </group>
        <group>
            <field name="date"/>
            <field name="observations"/>
        </group>
    </field>
</record>

This last code is being ignored of course. I did not know where I could declare this form view and I did it in the same XML document where I modified the res.partner form (through inheritance). I do not know if it can be a problem, I guess not.

Anyone can help me, please? Thank you!

EDIT (this is my new declaration of the form, not working yet)

<group string="Activity Summary">
    <field name="history" nolabel="1">
        <form string="Categories" version="7.0">
            <group col="4">
                <field name="link_category_id"/>
                <field name="type"/>
            </group>
            <group col="4">
                <field name="date"/>
                <field name="observations"/>
            </group>
        </form>
        <tree string="Categories">
            <field name="active_category"/>
            <field name="link_category_id"/>
            <field name="type"/>
            <field name="date"/>
            <field name="observations"/>
        </tree>
    </field>
</group>

2
Avatar
Buang
Pau Ubach

Hola Juan, You can just add a form inside of the field, as you do with the tree: ...

Juan Formoso Vasco
Penulis

Hey, I do not know why, but suddenly all the comments were removed when I sent the last one. I had written you that I needed to show a tree with only one record per category (the one with the latest date), so I used a function to return the list with the codes of these records.

Pau Ubach

OK, now I understand why you use the function field.

Pau Ubach

I assume you're defining the many2many field for the relation in res.partner.link.category, aren't you?

Juan Formoso Vasco
Penulis

No, I am not. The field function of type many2many is declared in res.partner.

Pau Ubach

OK. First of all, you shouldn't edit the res.partner. You should create a new module that inherits from it instead.

Juan Formoso Vasco
Penulis

Yes, I did so. The name of my module is res_partner_extended, inherits from res.partner and adds that column function of type many2many, pointing to res.partner.link.category, a table created by me from zero.

Pau Ubach

Great. I'm totally lost. When I had to do for one2many I just checked how was it done in an existing module. I don't know if there's any doing what you need. If you solve it, please post how have you done.

Juan Formoso Vasco
Penulis

Ok, I'll do that. Thank you so much for your patience.

Pau Ubach

No problem. I have had people having patience with me, so trying to help the others is the way to repay for it.

Avatar
Deepa Venkatesh
Jawaban Terbai

I assume you want to show just the tree view for M2M field, but unfortunately you cant prevent it from opening the form view...

Whenever you define a O2M or M2M field in view: when you have embedded its views within the field declaration, then preference are given to those local views, if not then it searchs whether any views exists for that object, if none, then odoo uses a default view by dumping all the fields into form view...
 

So in your code [edited code] though you have locally defined the views, but what you missed was the "mode" property to be set, which tells odoo that the views are defined locally...

Here your code goes something like this:

<field name="history" mode="tree,form" ... >

 

0
Avatar
Buang
Pau Ubach

I was waiting for you, deep ;). Actually my last comment in the question was done as a tribute to you.

Deepa Venkatesh

Oh is it.. :):) thank you

Juan Formoso Vasco
Penulis

Thank you deep, and Pau again. Now I know why OpenERP is behaving this way.

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