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

User-defined Filters - not accepting dynamic filters for e.g: "user_id","=", uid

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
filtersettingsdynamic
1 Balas
6626 Tampilan
Avatar
Robert Young

Odoo 13 Enterprise Edition

Having created a User-defined filter that is shared to all users, I have edited it to include user_id = uid as follows:

["&","&","&",["customer_rank",">",0],["activity_ids","!=",False],["user_id","=", uid],["activity_date_deadline","=","2021-01-12"]]
When saving, I get the following error message: The domain you entered was not properly formatted.

I have also tried replacing the static date for activity_date_deadline with a dynamic filter as follows:

["activity_date_deadline", "=", (context_today() + datetime.timedelta(days=1)).strftime('%%Y-%%m-%%d') ]

When saving this, the change is reverted silently - no error is displayed.

Question:  How should I edit the User-defined Filter to use dynamic filters for User and Date, please?

0
Avatar
Buang
Ray Carnes (ray)

What model are you creating this for? Does the model have a user_id field? Take a look at the Filters defined in the sale.order.list.select view which leverage both UID and context_today() https://github.com/odoo/odoo/blob/14.0/addons/sale/views/sale_views.xml#L728

Ibrahim Boudmir

Hi,

i see [] instead of () in your domain. it should be like this:

domain="[(condition), (condition), (condition), (), ..]"

in your case, it is:

[("customer_rank",">",0),("activity_ids","!=",False),("user_id","=", uid),("activity_date_deadline","=","2021-01-12")]

P.S: If all conditions must have and as an operator, no need to add it in the domain.

Robert Young
Penulis

@Ray Carnes

Thanks for your response. This is being created for the 'Contact' model. The model does have a user_id field - if limiting to a specific named user the filter works - for e.g: ["user_id","ilike","Austen"]

Thank you for the link to the view source that I will test with the the context_today option. If you have any other suggestions for the UID I would certainly appreciate it.

Thank you!

Alessandro Fiorino

Where are you entering the domain ? Are you using Studio ?

Robert Young
Penulis

@Alessandro Fiorino and @Ibrahim Boudmir

The steps that I follow are as follows:

1. Go to 'Contacts' and create a filter with the following rules:

---Companies,

---Add Custom Filter: Salesperson contains Austen,

---Add Custom Filter: Next Activity Deadline is equal to 13/01/2021

2. Select the drop-down beside 'Favourites' and select 'Save Current Search'

3. Set the name for the search, and select 'Share with all users' then SAVE.

4. Go to 'Settings' (make sure debug is enabled for this step)

5. Select Technical > User Interface > User-defined Filters

6. Select the custom filter created at step 3 and EDIT

The domain is set automatically when creating the filter from the Contacts module. The corresponding code in the code editor is also created by the action of creating the filter.

I am not using Studio for this task.

Let me know if any further information is required - many thanks.

Pierre

Any solution? I'm struggling with the same problem... 2 years later ...

Avatar
shubham shiroya
Jawaban Terbai

you can achieve dynamic filtering using the following approach:

  1. Create a Custom Filter:

    • First, create a custom filter as you've done.

    • In the filter's domain field, you'll need to set a static condition to ensure the filter is correctly saved. For example:

      ["&", ["customer_rank", ">", 0], ["activity_ids", "!=", False]]
      
  2. Use Context in the Action:

    • Instead of trying to set dynamic values directly in the filter, you can use context variables when defining an action. This action can be associated with a menu item or button.
  3. Set Dynamic Values in the Action:

    • In the action's context, you can set dynamic values for the user and date. Here's an example of how you can define the action:

       id="action_custom_filter" model="ir.actions.server">
          name="name">Custom Filter Action
          name="model_id" ref="model_your_model_name"/>
          name="state">code
          name="code">self.domain = [("customer_rank", ">", 0), ("activity_ids", "!=", False), ("user_id", "=", self.env.user.id), ("activity_date_deadline", "=", fields.Date.today() + timedelta(days=1))] 
      
      

      In this example, self.env.user.id is used to dynamically set the user, and fields.Date.today() + timedelta(days=1) sets the date to tomorrow.

  4. Use the Action in a Menu Item or Button:

    • Finally, you can create a menu item or button and associate it with the action you defined. When users click on this menu item or button, it will apply the dynamic filter based on the context values.


0
Avatar
Buang
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
Toggle <field>'s visibility in search view Diselesaikan
filter invisible dynamic
Avatar
Avatar
2
Mar 15
6662
How to show all users in filter list automatically by clicking on filter button?
filter users list dynamic
Avatar
Avatar
1
Jul 21
4715
Dynamicly apply filter for one2many field
filter domain one2many dynamic
Avatar
0
Des 16
6015
cbbbbggf
filter
Avatar
0
Nov 25
2
Factura en estado "EN PROCESO DE PAGO"
filter
Avatar
0
Nov 25
2
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