Skip to content

Commit

Permalink
Merge PR #1469 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by StefanRijnhart
  • Loading branch information
OCA-git-bot committed Feb 25, 2025
2 parents 5b0d436 + f60bfe9 commit 74d360e
Show file tree
Hide file tree
Showing 2 changed files with 22 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
16 changes: 16 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,22 @@ 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.team1.user_id = self.team1.member_ids[0]
server_action = self.env["ir.actions.server"].create(
{
"name": "Test Server Action 2",
"model_id": self.partner_ir_model.id,
"state": "next_activity",
"activity_type_id": self.activity2.id,
"activity_user_type": "specific",
"activity_user_id": self.employee.id,
}
)
with Form(server_action) as form:
form.activity_team_id = self.team1
self.assertEqual(form.activity_user_id, self.team1.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 74d360e

Please sign in to comment.