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

Is there a way to use a domain on a many2many field on openerp v6.1?

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
domainviewmany2many
16 Replies
34326 Tampilan
Avatar
Vivekrajan Rayappan

Hello,

Is it a way to use domain on many2many field on openerp v6.1?

Here is my object : Code:

class user(osv.osv):

_columns={
    'group_ids':fields.many2many('custom_module.group', 'custom_module_group_user_rel', 'user_id', 'group_id', 'Groups'), 
}
user()

class group(osv.osv):

_columns={
    'user_ids':fields.many2many('custom_module.group', 'custom_module_group_user_rel', 'group_id', 'user_id', 'Users'), 
}
group()

I have added these fields on the views and it works fine. My problem is that I'd like to select only users who are in a specific group but I can't find the correct domain to apply.

Here is my view : Code:

<record ..>
...
<field name="name"/>
<field name="group_id"/>
<field name="user_id" domain="[('id','in', [group_id.user_ids]])]"/>
...
</record>

I would like that by selecting a group, the user could only select a user in this group.

Does somebody know what is wrong with my domain ? Or is it possible ?

2
Avatar
Buang
Sam path

Hi vivek, you found any solution? even i'm facing the same problem please help me out

Sehrish

Domain on many2many field: http://bit.ly/2DarOfB

Avatar
Mohammad Alhashash
Jawaban Terbai

Try this

  ...
  <field name="user_id" domain="[('groupd_ids','=', group_id)]"/>
  ...
2
Avatar
Buang
Vivekrajan Rayappan
Penulis

Hi Mohammad,

Thanks for your reply. Your suggestion does not work.

Please see the logic inside your filter

<field name="user_id" domain="[('groupd_ids','=', group_id)]"/>

[field name="user_id" domain="[([1,3,4],'=',[1])]

This does not work. Please suggest me something else.

instead of '=' operator, if you have something like 'group_ids','has','group_id', it can work. But we dont have any such operator.

please suggest me a work around to achieve this.

Thank you

Vivekrajan Rayappan
Penulis

Hi, i found a link : http://forum.openerp.com/forum/topic23503.html , but I am not able to use that. If you could give me a sample code, It would be great. Please do the needful

Mohammad Alhashash

Actually x2many field handling in left-hand side of domains does not work as you think. You may have to quote the right-hand side ('group_id' instead of group_id). Check it and tell me the result.

Vivekrajan Rayappan
Penulis

that is also not working. Please see this link and tell me if tat works. http://forum.openerp.com/forum/topic23503.html

Vivekrajan Rayappan
Penulis

Please somebody help me on this.. I am in a big trouble

Mohammad Alhashash

My answer works in v7.0. I'm not sure about version 6.1. Sorry.

Mohammad Alhashash

It should work too in 6.1. Check the line: &lt;field name="stage_id" domain="section_id and [('section_ids', '=', section_id)] or []" /&gt; in addons/cr,/crm_lead_view.xml

Avatar
ClueLogics Technologies Pvt. Ltd.
Jawaban Terbai

Always use  in operator in domain if you seems need to check more then one such as many2many.



it shoud be domain="[('group_ids','in',[group_id])]"

3
Avatar
Buang
Avatar
Vivekrajan Rayappan
Penulis Jawaban Terbai

Hi Mohammad,

The answer you provided is the right one to filter based on many2many. I actually had the same domain filter in my code. But because of some redundancy of fields, it did not work.

Later I just removed the redundant fields and it worked like a charm.

so, The right answer is what you have suggested at first.

<field name="user_id" domain="[('groupd_ids','=', group_id)]"/>

Thanks for your support and sorry for the delay in updating the answer for my question.

2
Avatar
Buang
Mohammad Alhashash

You should not create a new answer for responding. Please read the FAQs. If the answer is correct, you should accept it and use the comment feature for response,

Vivekrajan Rayappan
Penulis

Ok. I shall keep that in mind henceforth. Thanks

Avatar
Gregor Heger
Jawaban Terbai

@Daniel Blankco

i know it is late, but in case somebody different reads this: function_id is located in the list view function_ids. Thereby, the scope of the domain lies within function_ids. So it it is not possible to address "function_ids" just by writing "function_ids[0][2]". The parent view, in which function_ids is located, has to be adressen. That is why parent. is for.
Entries in the function_ids list are represented by this list: [(6, 0, [1, 2, 3, 4])]. This is a so called x2many code. The ids of the function id fields is located in [1, 2, 3, 4]. So in order to address it, he writes parent.function_ids[0][2].
I don't really know why he is doing that.

0
Avatar
Buang
Avatar
namiri
Jawaban Terbai

try this

<field name="function_id" readonly="False" domain="[('id', 'in', parent.functions_ids[0][2])]"/>

0
Avatar
Buang
Ing. Daniel Blanco

@namiri, saw this in another question and post. Could you pleas explain each term inside the domain? I understand that 'id' referes to "the id of function_id", but parent... who is parent in this case? and what [0][2] stands for? refers to the element of the many2one declaration?

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
Domain not working in edit mode on Many2many field Diselesaikan
domain view many2many v14
Avatar
1
Sep 22
3707
Many2many domain works when click search more but wrong values in dropdown
domain many2many
Avatar
0
Nov 22
80
[SOLVED] Create rule using many2many - how to? Diselesaikan
domain many2many
Avatar
1
Jun 22
8130
Many2many domain not working Diselesaikan
domain many2many
Avatar
1
Jul 21
3532
Many2many domain not working Diselesaikan
domain many2many
Avatar
Avatar
1
Jul 21
5046
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