Skip to content

Commit

Permalink
[FIX]mail_activity_done: Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jesusVMayor committed Dec 30, 2024
1 parent 912897e commit 1f68c55
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 22 deletions.
3 changes: 3 additions & 0 deletions mail_activity_done/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@
"data": ["views/mail_activity_views.xml"],
"pre_init_hook": "pre_init_hook",
"uninstall_hook": "uninstall_hook",
"demo": [
"demo/mail_activity.xml",
],
}
12 changes: 12 additions & 0 deletions mail_activity_done/demo/mail_activity.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="activity_done_1" model="mail.activity">
<field name="activity_type_id" ref="mail.mail_activity_data_meeting" />
<field name="res_id" ref="base.res_partner_2" />
<field name="res_model">res.partner</field>
<field name="res_model_id" ref="base.model_res_partner" />
<field name="user_id" ref="base.user_demo" />
<field name="date_deadline">2024-01-01</field>
<field name="done" eval="True" />
</record>
</odoo>
11 changes: 7 additions & 4 deletions mail_activity_done/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -426,7 +427,9 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
Expand Down
24 changes: 6 additions & 18 deletions mail_activity_done/tests/test_mail_activity_done.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,6 @@ def setUp(self):
"date_deadline": date.today(),
}
)
self.act2 = self.env["mail.activity"].create(
{
"activity_type_id": activity_type.id,
"res_id": self.env.ref("base.res_partner_1").id,
"res_model": "res.partner",
"res_model_id": self.env["ir.model"]._get("res.partner").id,
"user_id": self.env.user.id,
"date_deadline": date.today(),
}
)
self.act2._action_done()

def test_mail_activity_done(self):
self.act1._action_done()
Expand All @@ -45,22 +34,21 @@ def test_systray_get_activities(self):
)

def test_read_progress_bar(self):
res_partner = self.env["res.partner"].browse(self.act1.res_model_id)
res_partner = self.env["res.partner"].browse(self.act1.res_id)
params = {
"domain": [],
"group_by": "id",
"progress_bar": {"field": "activity_state"},
}
result = res_partner._read_progress_bar(**params)
self.assertEqual(result[0]["__count"], 1)

self.act1._action_done()
self.assertEqual(self.act1.state, "done")
result = res_partner._read_progress_bar(**params)
self.assertEqual(len(result), 0)
self.assertEqual(len(result), 1)

def test_activity_state_search(self):
today_activities = self.env["res.partner"].search(
[("activity_state", "=", "today")]
)
self.assertEqual(len(today_activities), 1)
overdue_activities = self.env["res.partner"].search(
[("activity_state", "=", "overdue")]
)
self.assertEqual(len(overdue_activities), 0)

0 comments on commit 1f68c55

Please sign in to comment.