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

Chatter currently orders messages by id. Is there a way to order items by date?

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
chattermail.message
1 Cevapla
9743 Görünümler
Avatar
foo

Odoo 11. In the chatter dialog beneath a record, all the logs (from Log Note) are ordered by id. This is defined on the mail.message model:


```

class Message(models.Model):

""" Messages model: system notification (replacing res.log notifications),

comments (OpenChatter discussion) and incoming emails. """

_name = 'mail.message'

_description = 'Message'

_order = 'id desc'

```

Is there a way to order this by date? Simply inheriting the model and setting the _order did not work. eg. this is what I thought would work:

```

class Message(models.Model):

_inherit = 'mail.message'

_order = 'date desc'

```

Considering chatter has some Javascript involvement, I imagine there may be somewhere to change this in the javascript layer?

Thank you in advance! 

1
Avatar
Vazgeç
Avatar
Adrien
En İyi Yanıt

Hi,

I managed to do that the following way:

1. What you want is to modify the function _fetchDocumentMessages in JS file chat_manager.js from native 'mail' addon, in ChatManager class. Instead of sort by message id, you want to sort by date :

_fetchDocumentMessages : function (ids, options) {
var loaded_msgs = _.filter(messages, function (message) {
return _.contains(ids, message.id);
});
var loaded_msg_ids = _.pluck(loaded_msgs, 'id');

options = options || {};
if (options.force_fetch || _.difference(ids.slice(0, LIMIT), loaded_msg_ids).length) {
var ids_to_load = _.difference(ids, loaded_msg_ids).slice(0, LIMIT);

return this._rpc({
model: 'mail.message',
method: 'message_format',
args: [ids_to_load],
context: session.user_context,
})
.then(function (msgs) {
var processed_msgs = [];
_.each(msgs, function (msg) {
processed_msgs.push(add_message(msg, {silent: true}));
});
return _.sortBy(loaded_msgs.concat(processed_msgs), function (msg) {
//CUSTOM HERE: sort by date instead of id in native
return msg.date;
});
});
} else {
return $.when(loaded_msgs);
}
},

2. Thing is, the way ChatManager is defined, you cannot properly inherit it in your custom module (I can't explain exactly why, i am not JS expert)... In this case I found out it is not possible to use a "include" as usually done to overwrite only a JS class method.

3. So I copied / paste the whole chat_manager.js file from 'mail' module to my custom module, and made the previous modification in my pasted file

4. Then i told odoo to replace the native file by mine, by putting in the xml (note the expr in xpath and 'replace' position):

<template id="assets_backend" name="sort message by date assets" inherit_id="web.assets_backend">
<!--unable to inherit javascript properly. So whole script is replaced here-->
<!--see https://www.odoo.com/fr_FR/forum/aide-1/question/how-inheritance-of-a-js-mail-chat-manager-130963-->
<xpath expr="//script[@src='/mail/static/src/js/chat_manager.js']" position="replace">
<script src="/your_custom_module/static/src/js/chat_manager.js" type="text/javascript"/>
</xpath>

</template>
2
Avatar
Vazgeç
Techloyce

Yeah that is perfect solution for Odoov11 but I'm looking for version 13 can you please guide me how to do that..because there is no file in 'mail' as chat_manager.js

Aurel Balanay

Hi are you able to solve this in version 13?

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 show message_type = notification in a portal chatter? Çözüldü
chatter mail.message
Avatar
Avatar
1
Eyl 21
7617
Change Button Label in Chatter from "Send Message" to "Send e-mail" Çözüldü
chatter
Avatar
Avatar
1
Şub 25
2457
Chatter looks weird in 18.0 Çözüldü
chatter
Avatar
Avatar
2
Ara 24
3590
chat module
chatter
Avatar
0
Kas 24
7745
How to prevent/avoid automatic subscription as follower to newly created records (with chatter) Çözüldü
chatter
Avatar
Avatar
3
Eki 25
5856
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