diff options
| author | Thibault Delavallée <tde@odoo.com> | 2019-10-24 11:09:01 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2019-12-02 15:18:44 +0000 |
| commit | e2b33f460d0f2359e65107f8615c7e827350b4e7 (patch) | |
| tree | aacc4e64a6253dc57f3369ba5e2cc67312dfe2ea /addons/website_forum/models | |
| parent | 06f169a0ee0f7508f861c47ee2f39467df7b6dc1 (diff) | |
[REF] mail, various: rename subtype parameter of message_post to subtype_xmlid
PURPOSE
Clean posting process and improve mail.message definition and comprehension.
SPECIFICATIONS
In order to be more explicit subtype parameter is renamed to subtype_xmlid.
It therefore clearly indicates it should be a valid subtype Xml ID. Support
of ill formatted Xml IDs is removed because there is no reason to try to
add some random prefix. Give something that exists or go to hell, punk !
LINKS
Task ID 2071556
PR #38692
Diffstat (limited to 'addons/website_forum/models')
| -rw-r--r-- | addons/website_forum/models/forum.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/addons/website_forum/models/forum.py b/addons/website_forum/models/forum.py index f3738eb07e2..b21845bfd92 100644 --- a/addons/website_forum/models/forum.py +++ b/addons/website_forum/models/forum.py @@ -497,12 +497,12 @@ class Post(models.Model): if 'content' in vals or 'name' in vals: for post in self: if post.parent_id: - body, subtype = _('Answer Edited'), 'website_forum.mt_answer_edit' + body, subtype_xmlid = _('Answer Edited'), 'website_forum.mt_answer_edit' obj_id = post.parent_id else: - body, subtype = _('Question Edited'), 'website_forum.mt_question_edit' + body, subtype_xmlid = _('Question Edited'), 'website_forum.mt_question_edit' obj_id = post - obj_id.message_post(body=body, subtype=subtype) + obj_id.message_post(body=body, subtype_xmlid=subtype_xmlid) if 'active' in vals: answers = self.env['forum.post'].with_context(active_test=False).search([('parent_id', 'in', self.ids)]) if answers: @@ -717,7 +717,7 @@ class Post(models.Model): 'email_from': self_sudo.create_uid.email_formatted, # use sudo here because of access to res.users model 'body': tools.html_sanitize(self.content, sanitize_attributes=True, strip_style=True, strip_classes=True), 'message_type': 'comment', - 'subtype': 'mail.mt_comment', + 'subtype_xmlid': 'mail.mt_comment', 'date': self.create_date, } new_message = question.with_context(mail_create_nosubscribe=True).message_post(**values) |
