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
    • Discuss
    • 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 domain expression for many2many, with NOT operator

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
domainexpression12.0
3 Replies
8987 Tampilan
Avatar
Sprintit Oy / Roy Nurmi

I am trying to filter out records based on their tags, many2many field. I know that I can filter records using notation with name, as in:

[('tag_ids','=','TAGNAME')]

or with tag id, as in:

[('tag_ids.id','=',123)]

What I would like to do is filter OUT records that contain specific tag, say 'OUT'. Suprisingly this works as I want it to work:

[('tag_ids','!=','OUT')]

However, this presents a problem, because tag.name is language supported field, and I cannot list all possible translations in filter. I would rather use syntax with specific tag id, say:

[('tag_ids.id','!=',123)]

But this does not work. It works, if the only tag on the record is 123, but if there is any other tag on the object, it does not filter the record out.

So, is there any syntax to use so that domain filter would filter out records with given tag, so that tag is specified simply with id?

1
Avatar
Buang
Sehrish

Domain in many2many field: https://learnopenerp.blogspot.com/2018/12/add-domain-on-many2many-field-in-odoo.html

Avatar
Paresh Wagh
Jawaban Terbai

Hi Roy:

That's because when you have multiple tags, the id of each tag gets compared when you use [('tag_ids.id','!=',123)]. So the record gets selected if it contains any tag that is not 123.

Try this instead.

["!", ("tag_ids","in",[123])]


3
Avatar
Buang
Sprintit Oy / Roy Nurmi
Penulis

Hi, and thanks, this works. Great!

However, I still don't understand why. The principle I understand, but how odoo decides what field to use in comparison.

E.g. this uses name field: [('tag_ids','=','TAGNAME')]

Whereas this uses id: ("tag_ids","in",[123])

I would understand in better if we would always use explicit field definition, like 'tag_ids.id', but here seems to be some heuristic I do not understand, and is not documented anywhere? Is it related to the operator ('=' vs. 'in'), or is it determined by value type or what?

Paresh Wagh

One2many and Many2many fields like tag_ids in this case, return the recordset. When used in a comparison without a specific field, they reference the name field defined for the model. A good example of seeing this in action is in the Export functionality - if you export the field tag_ids you will get the name field but if you specifically select one of the fields the value of that field will get exported.

FERNANDO DAVID CALATAYUD ZEPEDA

Thanks for the heuristic explanation, Paresh. But here ("tag_ids","in",[123]), Odoo is still using the recordest without any specific field, and is still correctly using the field "id" instead of the "name".

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
Multi domain for Multi Store one Database
domain domain_filter e-commerce 12.0
Avatar
0
Feb 24
4542
naked domain set up Diselesaikan
domain
Avatar
Avatar
Avatar
Avatar
3
Jul 25
6389
Domain name Request
domain
Avatar
0
Mei 25
1744
How To Set Char Type Field Only Have Number Input ODOO 12 ?
12.0
Avatar
2
Jan 25
7651
computed fields Diselesaikan
12.0
Avatar
Avatar
1
Apr 24
3619
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