İç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

Advanced search() options like with where in sql.

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
searchodoo10
1 Cevapla
4900 Görünümler
Avatar
Samo Arko

I'm working with project, task, timesheet modules. I've extended the project_task model with field finish_date that is Date. I've also extended the model project_task_type with field task_usage that is a Selection field.

Because some tasks don't have finish date, I've got to look at tasks write_date and the the usage of the stage that the stage is in a stage that finished tasks are. The task cannot be written to when it gets to one of this "finish" stages 

I need to get timesheets that are in between two dates and that the task was finished in that date interval. So if there is no finish_date it looks at write_date and checks that the task is in the correct stage.

I'm trying to get them with this search:

account_analytic_line_env = self.env['account.analytic.line']

finished_tasks_timesheets = account_analytic_line_env.sudo().search([
('task_id.project_id', '=', project.id),
('task_id.partner_id', '=', doc_data.partner_id.id),
('date', '>=', dates.get('date_from')),
('date', '<=', dates.get('date_to')),
'&', '|', '&', '&', '&', ('task_id.finish_date', '>=', dates.get('date_from')), ('task_id.finish_date', '<=', dates.get('date_to')),
('task_id.finish_date', '=', False),
('task_id.write_date', '>=', '{} 00:00:00'.format(dates.get('date_from'))), ('task_id.write_date', '<=', '{} 23:59:59'.format(dates.get('date_to'))),
('task_id.stage_id.task_usage', 'in', ['3', '4', '5'])
], order='task_id asc')

I need to get it like (not real SQL syntax not going to write all the joins only the WHERE clause with odoo relation fields and the base (FROM) is the timesheet model):

WHERE task_id.project_id = project.id AND task_id.partner_id = doc_data.partner_id.id
AND (date >= dates.get('date_from') AND date <= dates.get('date_to'))
AND (
(task_id.finish_date >= dates.get('date_from') AND task_id.finish_date <= dates.get('date_to'))
OR 
(task_id.finish_date = False AND 
(task_id.write_date >= '{} 00:00:00'.format(dates.get('date_from')) AND task_id.write_date <= '{} 23:59:59'.format(dates.get('date_to')))
AND task_id.stage_id.task_usage IN ('3', '4', '5')
) 
)
 

Hope I've gotten all the "()" right because this new forum text field is just bad compared to the old one. :(

Can' someone help me this search "query"?  


0
Avatar
Vazgeç
Avatar
Samo Arko
Üretici En İyi Yanıt

Don't bother with the answer... I've gotten all timesheets and just used a few of if else to do the job. 

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
how to use and in search? Çözüldü
search odoo10
Avatar
Avatar
Avatar
2
Ara 22
17062
Odoo customized search
search odoo10
Avatar
1
Nis 20
142
ValueError: Expected singleton problem that I can't figure out
search odoo10
Avatar
2
Haz 18
89
Get specific record out of the all the records by field value
search odoo10
Avatar
0
Mar 18
6455
how to add new fields for search in SO/RFQ? Çözüldü
search search_view odoo10
Avatar
Avatar
Avatar
Avatar
3
May 24
4426
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