From 01ff1cd22604867e8cd96f622a3024d92200755b Mon Sep 17 00:00:00 2001 From: "Didier (did)" Date: Mon, 20 Dec 2021 11:52:07 +0000 Subject: [PATCH] [FIX] mail: user cannot edit a message that is not a comment type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this PR, user could edit notifications message. task-2713602 closes odoo/odoo#81803 X-original-commit: 45e9f367d583ec8fafdf19c9e5451bdff0e16e62 Signed-off-by: Sébastien Theys (seb) --- addons/mail/i18n/en_GB.po | 6 ++++++ addons/mail/models/mail_thread.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/addons/mail/i18n/en_GB.po b/addons/mail/i18n/en_GB.po index 795b679cf09..93711113205 100644 --- a/addons/mail/i18n/en_GB.po +++ b/addons/mail/i18n/en_GB.po @@ -5656,3 +5656,9 @@ msgstr "" #, python-format msgid "unknown target model %s" msgstr "" + +#. module: mail +#: code:addons/mail/models/mail_thread.py:1892 +#, python-format +msgid "Only messages type comment can have their content updated" +msgstr "" diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 7d2c9a5f17b..37dffb764ea 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -459,6 +459,8 @@ class MailThread(models.AbstractModel): raise exceptions.UserError(_("Only logged notes can have their content updated on model '%s'", self._name)) if message.tracking_value_ids: raise exceptions.UserError(_("Messages with tracking values cannot be modified")) + if not message.message_type == 'comment': + raise exceptions.UserError(_("Only messages type comment can have their content updated")) # ------------------------------------------------------ # TRACKING / LOG