[FIX] mail: user cannot edit a message that is not a comment type

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) <seb@odoo.com>
This commit is contained in:
Didier (did)
2021-12-22 12:11:41 +00:00
parent acab821676
commit 01ff1cd226
2 changed files with 8 additions and 0 deletions
+6
View File
@@ -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 ""
+2
View File
@@ -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