[MIG] mail_notification_custom_subject: migration to 17.0

pull/1349/head
maciej-wichowski 2024-04-09 12:07:37 +02:00
parent f7b15d4e6f
commit fde4ba078a
4 changed files with 5 additions and 26 deletions

View File

@ -5,7 +5,7 @@
{
"name": "Mail Notification Custom Subject",
"summary": "Apply a custom subject to mail notifications",
"version": "15.0.1.0.2",
"version": "17.0.1.0.0",
"category": "Social Network",
"website": "https://github.com/OCA/social",
"author": "Tecnativa, Odoo Community Association (OCA)",

View File

@ -1,20 +0,0 @@
# pylint: disable=C7902
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade
@openupgrade.migrate()
def migrate(env, version):
env.cr.execute(
"""
UPDATE mail_message_custom_subject
SET subject_template=REPLACE(
REPLACE(
subject_template,
'${',
'{{'),
'}',
'}}'
)
"""
)

View File

@ -24,8 +24,7 @@ class MailThread(models.AbstractModel):
partner_ids=None,
attachments=None,
attachment_ids=None,
add_sign=True,
record_name=False,
body_is_html=False,
**kwargs,
):
if subtype_xmlid:
@ -81,7 +80,6 @@ class MailThread(models.AbstractModel):
partner_ids=partner_ids,
attachments=attachments,
attachment_ids=attachment_ids,
add_sign=add_sign,
record_name=record_name,
body_is_html=body_is_html,
**kwargs,
)

View File

@ -90,7 +90,8 @@ class TestMailNotificationCustomSubject(common.TransactionCase):
"name": "Test template 2",
"model_id": self.env.ref("base.model_res_partner").id,
"subtype_ids": [(6, 0, [self.env.ref("mail.mt_comment").id])],
"subject_template": "{{object.name or 'n/a'}} and something different",
"subject_template": "{{object.name or 'n/a'}} and "
"something different",
}
)
# Send message in partner