[13.0] Fixed context field get

On fetchmail_thread_default when creating a new mail.message it says the context["fetchmail_server_id"] is None, the field value is context["default_fetchmail_server_id"].
pull/1329/head
Ismaw34 2021-01-15 12:46:42 +01:00 committed by ntsirintanis
parent e3bb8861ab
commit f461ca24b5
2 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@ class MailThread(models.AbstractModel):
thread_id=None,
):
server = self.env["fetchmail.server"].browse(
self.env.context.get("fetchmail_server_id")
self.env.context.get("default_fetchmail_server_id")
)
if server.default_thread_id and not (model or thread_id):
model = server.default_thread_id._name

View File

@ -37,7 +37,7 @@ class FetchmailCase(SavepointCase):
"""An unbound incoming email gets posted to the sink."""
# Imitate what self.server.feth_mail() would do
result = self.MailThread.with_context(
fetchmail_server_id=self.server.id
default_fetchmail_server_id=self.server.id
).message_process(
self.server.object_id.model,
MAIL_TEMPLATE.format(