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

Filter and group_by for many2many fields. How to do that?

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
filtermany2manygroup_by
1 Cevapla
21813 Görünümler
Avatar
Paulo Matos

Hello everyone,

I am trying to create a group for my search view which includes a many2many field.
When I try to load the "group by" option I have created for this many2many field, I get the error:

assert gb_field.store and gb_field.column_type, "Fields in 'groupby' must be regular database-persisted fields (no function or related fields), or function fields with store=True"
AssertionError: Fields in 'groupby' must be regular database-persisted fields (no function or related fields), or function fields with store=True

My many2many field is declared as:
mechanic_ids = fields.Many2many('res.users', relation='timesheet_rel_users', column1='id',column2='name') 

On XML for the search view I have:

The above error is raised when I try to load this specific "group by" option.

Is there any way I can create a "group by" option which includes a many2many field?

Thank you in advance

Best regards

Paulo

0
Avatar
Vazgeç
Avatar
faOtools
En İyi Yanıt

It is not possible to group by many2many field.

In that case the line might be shown on the Odoo interface more than one time, what is not acceptable.

As alternative you can create a many2one field which would compute the 'main' record from many2many. For example, you can group partner by tags, but you can group by some computed 'main tag'.

Besides, search by many2many field would work. An example from res.partner: 

<field name="category_id" string="Tag" filter_domain="[('category_id','ilike', self)]"/>

Also you may generate some custom report for your model, which would join tables in the way you like (SQL statement).

UPDATE

@api.multi
@api.depends('mechanic_ids')
def _compute_mynewfield_id(self):
for record in self:
record.mynewfield_id = record.mechanic_ids and record.mechanic_ids[0] or False


mynewfield_id = fields.Many2one('mechanic_ids', compute=_compute_mynewfield_id, store=True) # it is possible to search only among stored fields

4
Avatar
Vazgeç
Paulo Matos
Üretici

Hi @Odoo Tools,

Thank you very much once again for your help on my path on learning Odoo development.

I have tried to create a "computed" field for this purpose I was unable to do it.

Can you please help me with a sample code?

My many2many field is declared as:

myfield_ids = fields.Many2many('res.users', relation='timesheet_rel_users', column1='id',column2='name')

I have tried to create a many2one computed field declared as:

mynewfield_id = fields.Many2one('mechanic_ids', compute='_get_values, store=False)

My incomplete function:

@api.one

@api.depends('mechanic_ids')

def _get_values(self):

value = self.mechanic_ids

for record in value:

I am stuck from this point forward.

From here, If I print the "value", I can get the desired value for every and each record, but do not know how to complete the function and pass it to XML view filter.

Thank you once again

Best regards

Paulo

faOtools

see the update

Paulo Matos
Üretici

Dear @Odoo Tools,

Thank you very very much once again.

+1000 for you

Best regards

Paulo

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
Remove a value from many2many related field. How to do that? Çözüldü
filter many2many
Avatar
Avatar
Avatar
2
Tem 19
11971
Create e list from records on many2many relational field Çözüldü
filter many2many
Avatar
Avatar
1
Haz 19
7659
How to add domain filter & default 'group by 'to the existing field in inherit model
filter group_by odoo16features
Avatar
0
Şub 23
3306
Expand "group by" filter by default
filter group_by filtering
Avatar
Avatar
1
Ağu 21
12240
How to Use Domain Filter with Many2Many field
filter domain many2many
Avatar
Avatar
1
Ağu 24
8559
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