İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

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

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
filtersettingsdynamic
1 Cevapla
6648 Görünümler
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
Vazgeç
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
Üretici

@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
Üretici

@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
En İyi Yanıt

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
Vazgeç
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
Toggle <field>'s visibility in search view Çözüldü
filter invisible dynamic
Avatar
Avatar
2
Mar 15
6668
How to show all users in filter list automatically by clicking on filter button?
filter users list dynamic
Avatar
Avatar
1
Tem 21
4722
Dynamicly apply filter for one2many field
filter domain one2many dynamic
Avatar
0
Ara 16
6018
cbbbbggf
filter
Avatar
0
Kas 25
2
Factura en estado "EN PROCESO DE PAGO"
filter
Avatar
0
Kas 25
2
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

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