From 5e074f7bb284765c6cb6b004f6cc0df57ee5e1e9 Mon Sep 17 00:00:00 2001 From: clementmbr Date: Thu, 29 Sep 2022 19:43:06 +0200 Subject: [PATCH] [ADD] new module mail_message_date_order --- mail_message_date_order/__init__.py | 0 mail_message_date_order/__manifest__.py | 17 ++++++++++++++ .../src/models/mail_message_date_order.js | 22 +++++++++++++++++++ .../views/mail_message_date_order.xml | 15 +++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 mail_message_date_order/__init__.py create mode 100644 mail_message_date_order/__manifest__.py create mode 100644 mail_message_date_order/static/src/models/mail_message_date_order.js create mode 100644 mail_message_date_order/views/mail_message_date_order.xml diff --git a/mail_message_date_order/__init__.py b/mail_message_date_order/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/mail_message_date_order/__manifest__.py b/mail_message_date_order/__manifest__.py new file mode 100644 index 00000000..5a3d420b --- /dev/null +++ b/mail_message_date_order/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2021 Akretion +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Mail Message Date Order", + "description": """ + Order chatter's messages by date instead of by ID + """, + "version": "14.0.1.0.0", + "license": "AGPL-3", + "author": "Akretion", + "website": "akretion.com", + "depends": ["mail"], + "data": [], + "demo": [], + "data": ["views/mail_message_date_order.xml"], +} diff --git a/mail_message_date_order/static/src/models/mail_message_date_order.js b/mail_message_date_order/static/src/models/mail_message_date_order.js new file mode 100644 index 00000000..69267782 --- /dev/null +++ b/mail_message_date_order/static/src/models/mail_message_date_order.js @@ -0,0 +1,22 @@ +odoo.define("mail_message_date_order/static/src/models/mail_message_date_order.js", function(require) { + "use strict"; + + function factory(dependencies) { + class ThreadCache extends dependencies['mail.model'] { + + /** + * @override + */ + _computeOrderedMessages() { + const res = super._computeOrderedMessages(...arguments); + console.log("---IN OVERRIDE ORDERED MESSAGES cache"); + // return [['replace', this.messages.sort((m1, m2) => m1.date._d < m2.date._d ? -1 : 1)]]; + return res; + } + + + + } + } + +}); diff --git a/mail_message_date_order/views/mail_message_date_order.xml b/mail_message_date_order/views/mail_message_date_order.xml new file mode 100644 index 00000000..b533b6d8 --- /dev/null +++ b/mail_message_date_order/views/mail_message_date_order.xml @@ -0,0 +1,15 @@ + + +