[MIG] mail_activity_creator: Migration to 15.0

This commit is contained in:
Joan Mateu Jordi 2021-11-30 12:24:44 +01:00
parent 5abf597129
commit 0fb64207aa
2 changed files with 9 additions and 6 deletions

View File

@ -5,7 +5,7 @@
"name": "Mail Activity Creator", "name": "Mail Activity Creator",
"summary": """ "summary": """
Show activities creator""", Show activities creator""",
"version": "14.0.1.0.0", "version": "15.0.1.0.0",
"license": "AGPL-3", "license": "AGPL-3",
"author": "Creu Blanca,Odoo Community Association (OCA)", "author": "Creu Blanca,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/social", "website": "https://github.com/OCA/social",

View File

@ -8,6 +8,7 @@ from odoo.tests.common import TransactionCase
class TestCreator(TransactionCase): class TestCreator(TransactionCase):
def setUp(self): def setUp(self):
super().setUp() super().setUp()
self.partner = self.env["res.partner"].create({"name": "DEMO"}) self.partner = self.env["res.partner"].create({"name": "DEMO"})
self.user_01 = self.env["res.users"].create( self.user_01 = self.env["res.users"].create(
{ {
@ -17,26 +18,28 @@ class TestCreator(TransactionCase):
"notification_type": "inbox", "notification_type": "inbox",
} }
) )
self.model_id = self.env["ir.model"]._get("res.partner").id self.partner_model = self.env["ir.model"]._get("res.partner")
self.activity_type = self.env["mail.activity.type"].create( self.ActivityType = self.env["mail.activity.type"]
self.activity1 = self.ActivityType.create(
{ {
"name": "Initial Contact", "name": "Initial Contact",
"delay_count": 5, "delay_count": 5,
"summary": "ACT 1 : Presentation, barbecue, ... ", "summary": "ACT 1 : Presentation, barbecue, ... ",
"res_model_id": self.model_id, "res_model": self.partner_model.model,
} }
) )
def test_activity_creator(self): def test_activity_creator(self):
activity = ( activity = (
self.env["mail.activity"] self.env["mail.activity"]
.sudo()
.with_user(self.user_01.id) .with_user(self.user_01.id)
.create( .create(
{ {
"activity_type_id": self.activity_type.id, "activity_type_id": self.activity1.id,
"note": "Partner activity 3.", "note": "Partner activity 3.",
"res_id": self.partner.id, "res_id": self.partner.id,
"res_model_id": self.model_id, "res_model_id": self.partner_model.id,
"user_id": self.user_01.id, "user_id": self.user_01.id,
} }
) )