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

field.function in tree view

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
v6
2 Replies
14415 Tampilan
Avatar
Tajjajt

hi !

I have in my new module a functional field, whene i put it in my tree view i can't open my view.

here the action code :

    <record id="my_module_normal_action" model="ir.actions.act_window">
    <field name="name">My module</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">mymodule</field>
<field name="domain">[('my_field','=',True)]</field>
    <field name="view_type">form</field>
    <field name="view_id" ref="my_module_tree_view"/>
    <field name="search_view_id" ref="my_module_search_form_view"/>
</record>

my code xml :

<record id="my_module_tree_view" model="ir.ui.view">
            <field name="name">my.module.tree</field>
            <field name="model">mymodule</field>
            <field name="type">tree</field>
            <field eval="7" name="priority"/>
            <field name="arch" type="xml">
                <tree string="my module">
                   <field name="my_string"/>
            <field name="my_field"/>
                </tree>
            </field>
        </record>

in my python code :

  'my_field': fields.function(_get_concatenate_values, method=True, string='Reference', type='char'),

this is the function's code :

def _get_concatenate_values(self, cr, uid, ids, field_name, arg, context=None):
            records=self.browse(cr,uid,ids)
            result={}
            for r in records:
                if(r.field1 and r.field2):
                    result[r.id]= str(r.field1.name)+'.'+ str(r.field2.name)
                return result

"my_field"'s value is the concatenation of the two fields :field1 and field2

thanks for your reply.

0
Avatar
Buang
Andreas Brueckl

What version of OpenERP are you using? Your field is called 'code' but you use 'my_string' and 'my_module' in the view?

Tajjajt
Penulis

I use V6.0.2 , my feild's name is 'my_field', 'my_sring' is an other field in my module. so I rectify the python code : 'my_field': fields.function(_get_concatenate_values, method=True, string='Reference', type='char'),

Avatar
Lucio
Jawaban Terbai

In the definition of the action, you need to add:

<field name="view_mode">tree,form</field>

or

<field name="view_mode">form,tree</field>

depending in the order you want the views to be accessed.

(Or maybe just <field name="view_mode">tree</field> if you do not have a form view.)

I think the problem is in your domain statement in the definition of the action!

<field name="domain">[('my_field','=',True)]</field>

I think you are trying to say that it is not empty, but this restriction is satisfied only if the field has the boolean value True. Change it to:

 <field name="domain">[('my_field','&lt;&gt',False)]</field>

This means that is different to False that, I think, is more acccurate.

Hope it helps!

2
Avatar
Buang
Tajjajt
Penulis

It dosnt work !!

here a picture of my problem:

[URL=http://www.imagup.com/data/1176824638.html][IMG]http://data.imagup.com/12/1176824638.png[/IMG][/URL]

I have 3 rows but invisible, when I delete the line <field name="my_field"/> from the tree code it works and I have my liste

Tajjajt
Penulis

link to the picture : http://www.imagup.com/data/1176824638.html

Lucio

Without the 'my_field' field it works just fine? What's the message error you are getting?

Tajjajt
Penulis

yes without 'my_fiels' it works fine, i have no msg error, i can't see my data?

Tajjajt
Penulis

any help !!

Lucio

I updated my answer, maybe that is the problem! I do not see any other possibility of change!

Andreas Brueckl

Please update your question with the code of "_get_concatenate_values"

Lucio

Did it work?

Tajjajt
Penulis

no !! I have the same problem.

Tajjajt
Penulis

I updated my question

Avatar
Tony Gu
Jawaban Terbai

You defined a domain in act_window based on the function field 'my_field', while you didn't define a "fnct_search" search method for that function field.

Update: Another option would be to add store=True to the function field.

0
Avatar
Buang
Lucio

As far as I know, store=True will be used for the value of the field to be stored in the database. But, is this necessary to just show it in a tree view and filter the domain? I think it is not, but then again, I am not sure

Andreas Brueckl

For the domain filter only, the store flag is not required. Only if you want to use in the SearchView.

Lucio

Yes, in that case, I see what you are saying! Thanks!

Tajjajt
Penulis

I added "store=True" to my function field but during the installation of the module I get this error :

=================
Traceback (most recent call last):
  File "netsvc.pyo", line 489, in dispatch
  File "service\web_services.pyo", line 599, in dispatch
  File "osv\osv.pyo", line 122, in wrapper
  File "osv\osv.pyo", line 176, in execute
  File "osv\osv.pyo", line 167, in execute_cr
  File "C:\Program Files\OpenERP 6.0\Server\addons\base\module\wizard\base_module_upgrade.py", line 98, in upgrade_module
  File "pooler.pyo", line 60, in restart_pool
Tajjajt
Penulis
  File "pooler.pyo", line 39, in get_db_and_pool
  File "addons\__init__.pyo", line 883, in load_modules
  File "addons\__init__.pyo", line 719, in load_module_graph
  File "addons\__init__.pyo", line 414, in init_module_objects
  File "osv\orm.pyo", line 2651, in _auto_init
  File "osv\orm.pyo", line 378, in get_pg_type
TypeError: int argument required
=============
Tajjajt
Penulis

can you help me plz ?!

joshuajan
def _get_concatenate_values(self, cr, uid, ids, field_name, arg, context=None):
    records=self.browse(cr,uid,ids)
    result={}
    for r in records:
        if(r.field1 and r.field2):
            result[r.id]= str(r.field1.name)+'.'+ str(r.field2.name)
        #return result
    return result

I think there is a problem of you return value.

Tajjajt
Penulis

can anyone help me plz!

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 reset default values for a specific user? Diselesaikan
v6
Avatar
Avatar
1
Des 17
14368
how to get url of current page Diselesaikan
v6
Avatar
Avatar
Avatar
2
Des 23
23512
How to find all the customer invoices that were paid after the due date?
v6
Avatar
Avatar
1
Mar 15
6929
Limiting access Controls to Allocation requests in Holidays
v6
Avatar
1
Mar 15
4841
JasperReports won't evaluate null nor 0
v6
Avatar
0
Mar 15
4538
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