[16.0][ADD] mail_message_view: list the chatter messages in a menu - #247
[16.0][ADD] mail_message_view: list the chatter messages in a menu#247smorita7749 wants to merge 1 commit into
Conversation
e15eb3e to
e0667aa
Compare
The chatter mixes the messages posted by users with the ones logged by the system, so following a long history is tedious, and the tracked field changes are only readable from the chatter itself, as tracking_value_ids is restricted to base.group_system. This module lists the messages in a dedicated menu, where they can be searched, filtered and grouped, with a plain text preview of the body and a summary of the tracked field changes. A button opening the same list for a single record can be added on the form views of the wanted models. Assisted-by: Claude Opus 5
e0667aa to
448c939
Compare
| _inherit = "mail.message" | ||
|
|
||
| document_name = fields.Char(string="Document", compute="_compute_document_name") | ||
| body_preview = fields.Char(compute="_compute_body_preview") |
There was a problem hiding this comment.
Can't we use odoo standard field preview?
| class MailMessage(models.Model): | ||
| _inherit = "mail.message" | ||
|
|
||
| document_name = fields.Char(string="Document", compute="_compute_document_name") |
There was a problem hiding this comment.
document_name shadows the stored record_name with an unstored compute, so the column can't be sorted, searched or grouped, and it costs a display_name read per model per page. The gap is real but it's a core inconsistency — message_post fills record_name while _message_log/_message_log_batch pass 'record_name': False, skipping the backfill in _message_create — so it's better closed by filling the field on create (batched per model) than by computing it on read.
There was a problem hiding this comment.
Please add yourself as a maintainer.
| </field> | ||
| <!-- The subject is empty on most of the chatter messages. --> | ||
| <field name="subject" position="attributes"> | ||
| <attribute name="optional">hide</attribute> |
There was a problem hiding this comment.
Shouldn't we flip it to show?
| </field> | ||
| <field name="res_id" position="attributes"> | ||
| <attribute name="optional">hide</attribute> | ||
| </field> |
There was a problem hiding this comment.
I think this will be useful.
| </field> | |
| </field> | |
| <field name="res_id" position="after"> | |
| <button | |
| name="action_open_document" | |
| type="object" | |
| icon="fa-file-text-o" | |
| title="Open Document" | |
| attrs="{'invisible': ['|', ('model', '=', False), ('res_id', '=', 0)]}" | |
| optional="show" | |
| /> | |
| </field> |
| @@ -0,0 +1,81 @@ | |||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | |||
There was a problem hiding this comment.
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | |
| # Copyright 2026 Quartile (https://quartile.co) | |
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). |
Do the same to other files.
|
@smorita7749 Can we rename the module to mail_message_history? |
This module lists the chatter messages in a dedicated Discuss > Message History
menu, where they can be searched, filtered and grouped.
The chatter mixes the messages posted by users with the ones logged by the system
(field tracking, automated notifications), which makes a long history tedious to
follow. On top of that, the tracked field changes are only readable from the
chatter, as
tracking_value_idsis restricted tobase.group_system.The list therefore shows, as plain text, a preview of the message body and a
summary of the tracked field changes, e.g.
Status: RFQ -> Purchase Order, andprovides filters telling the messages posted by users apart from the ones logged
by the system.
Notes:
mode), so the standard Messages list is left unchanged;
models listed in the
mail_message_view.button_modelssystem parameter;document is an expensive query.
Targeting 16.0 as this is the series where the module is used, but I am happy to
forward-port it first if maintainers prefer new modules to land on the latest
branch.
This is a new module of about 1000 lines, which is above the 500 lines of the OCA
metrics red lines. Please let me know how you would like to proceed with the
review.
Assisted-by: Claude Opus 5
@qrtl QT7086