Skip to content

Commit

Permalink
[IMP] mail_activity_team: Add responsible as activity team leader if …
Browse files Browse the repository at this point in the history
…exists on server actions
  • Loading branch information
HviorForgeFlow committed Oct 14, 2024
1 parent 47ec998 commit abf6514
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mail_activity_team/models/ir_actions_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# @author Iván Todorovich <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models
from odoo import api, fields, models


class IrActionsServer(models.Model):
Expand All @@ -18,3 +18,8 @@ def _run_action_next_activity(self, eval_context=None):
if self.activity_user_type == "specific" and self.activity_team_id:
self = self.with_context(force_activity_team=self.activity_team_id)
return super()._run_action_next_activity(eval_context=eval_context)

@api.onchange("activity_team_id")
def onchange_activity_team_id(self):
if self.activity_team_id.user_id:
self.activity_user_id = self.activity_team_id.user_id
7 changes: 7 additions & 0 deletions mail_activity_team/tests/test_mail_activity_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,13 @@ def test_schedule_activity_from_server_action(self):
action.with_context(active_model=partner._name, active_ids=partner.ids).run()
self.assertEqual(partner.activity_ids[-1].team_id, self.team2)

def test_server_action_onchanges_activity_team_id_activity_user_id(self):
self.assertEqual(self.act2.activity_type_id, self.activity2)
with Form(self.env["ir.actions.server"]) as form:
form.activity_user_type = "specific"
form.activity_team_id = self.team2
self.assertEqual(form.activity_user_id, self.team2.user_id)

def test_my_activity_date_deadline(self):
"""This test case checks
- if the team activities are properly filtered
Expand Down

0 comments on commit abf6514

Please sign in to comment.