2018-08-23 01:26:55 +02:00
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
|
|
|
2019-01-14 09:04:02 +01:00
|
|
|
from datetime import date
|
2018-08-23 01:26:55 +02:00
|
|
|
|
2021-08-13 12:50:46 +02:00
|
|
|
from odoo.tests.common import TransactionCase
|
|
|
|
|
2018-08-23 01:26:55 +02:00
|
|
|
|
|
|
|
class TestMailActivityDoneMethods(TransactionCase):
|
|
|
|
def setUp(self):
|
|
|
|
super(TestMailActivityDoneMethods, self).setUp()
|
|
|
|
|
2021-08-13 12:50:46 +02:00
|
|
|
self.employee = self.env["res.users"].create(
|
|
|
|
{
|
|
|
|
"company_id": self.env.ref("base.main_company").id,
|
|
|
|
"name": "Test User",
|
|
|
|
"login": "testuser",
|
|
|
|
"groups_id": [(6, 0, [self.env.ref("base.group_user").id])],
|
|
|
|
}
|
|
|
|
)
|
|
|
|
activity_type = self.env["mail.activity.type"].search(
|
|
|
|
[("name", "=", "Meeting")], limit=1
|
|
|
|
)
|
|
|
|
self.act1 = self.env["mail.activity"].create(
|
|
|
|
{
|
|
|
|
"activity_type_id": activity_type.id,
|
|
|
|
"res_id": self.env.ref("base.res_partner_1").id,
|
|
|
|
"res_model_id": self.env["ir.model"]._get("res.partner").id,
|
|
|
|
"user_id": self.employee.id,
|
|
|
|
"date_deadline": date.today(),
|
|
|
|
}
|
|
|
|
)
|
2018-08-23 01:26:55 +02:00
|
|
|
|
|
|
|
def test_mail_activity_done(self):
|
|
|
|
self.act1.done = True
|
2022-01-19 12:36:28 +01:00
|
|
|
self.assertEqual(self.act1.state, "done")
|
2018-08-23 01:26:55 +02:00
|
|
|
|
2019-03-25 16:10:21 +01:00
|
|
|
def test_systray_get_activities(self):
|
2022-01-19 17:10:24 +01:00
|
|
|
act_count = self.employee.with_user(self.employee).systray_get_activities()
|
2021-08-13 12:50:46 +02:00
|
|
|
self.assertEqual(
|
|
|
|
len(act_count), 1, "Number of activities should be equal to one"
|
|
|
|
)
|