[FIX] mail_quoted_reply: format of default m2m value in context (fixes tests)

This commit is contained in:
Stefan Rijnhart 2023-01-13 15:27:41 +01:00
parent e203c128ec
commit b4a1b7a1d2
2 changed files with 8 additions and 2 deletions

View File

@ -43,6 +43,6 @@ class MailMessage(models.Model):
"is_quoted_reply": True,
"default_notify": True,
"force_email": True,
"default_partner_ids": [(6, 0, self.partner_ids.ids)],
"default_partner_ids": self.partner_ids.ids,
}
return action

View File

@ -13,7 +13,11 @@ class TestMessageReply(TransactionCase):
partner.message_ids.filtered(lambda r: r.message_type != "notification")
)
# pylint: disable=C8107
message = partner.message_post(body="demo message", message_type="email")
message = partner.message_post(
body="demo message",
message_type="email",
partner_ids=self.env.ref("base.partner_demo").ids,
)
partner.refresh()
self.assertIn(
message,
@ -28,6 +32,8 @@ class TestMessageReply(TransactionCase):
wizard = (
self.env[action["res_model"]].with_context(**action["context"]).create({})
)
self.assertTrue(wizard.partner_ids)
self.assertEqual(message.partner_ids, wizard.partner_ids)
# the onchange in the composer isn't triggered in tests, so we check for the
# correct quote in the context
email_quote = re.search("<p>.*?</p>", wizard._context["quote_body"]).group()