mirror of https://github.com/OCA/social.git
commit
8dc63c138c
|
@ -66,10 +66,16 @@ class MailActivity(models.Model):
|
||||||
# (for example with exception type activity, with no backorder).
|
# (for example with exception type activity, with no backorder).
|
||||||
# SUPERUSER is inactive and then even if you add it
|
# SUPERUSER is inactive and then even if you add it
|
||||||
# to member_ids it's not taken account
|
# to member_ids it's not taken account
|
||||||
# To not be blocked we must add it to constraint condition
|
# To not be blocked we must add it to constraint condition.
|
||||||
if activity.user_id.id != SUPERUSER_ID and activity.team_id and \
|
# We must consider also users that could be archived but come from
|
||||||
activity.user_id and \
|
# an automatic scheduled activity
|
||||||
activity.user_id not in activity.team_id.member_ids:
|
if (
|
||||||
|
activity.user_id.id != SUPERUSER_ID
|
||||||
|
and activity.team_id and activity.user_id
|
||||||
|
and activity.user_id not in activity.team_id.with_context(
|
||||||
|
active_test=False
|
||||||
|
).member_ids
|
||||||
|
):
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
_('The assigned user is not member of the team.'))
|
_('The assigned user is not member of the team.'))
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,8 @@ class MailActivityMixin(models.AbstractModel):
|
||||||
team = self.env["mail.activity"].with_context(
|
team = self.env["mail.activity"].with_context(
|
||||||
default_res_model=self._name,
|
default_res_model=self._name,
|
||||||
)._get_default_team_id(user_id=user_id)
|
)._get_default_team_id(user_id=user_id)
|
||||||
if team:
|
# Even if it comes empty, we don't want to mismatch the user's team
|
||||||
act_values.update({"team_id": team.id})
|
act_values.update({"team_id": team.id})
|
||||||
return super().activity_schedule(
|
return super().activity_schedule(
|
||||||
act_type_xmlid=act_type_xmlid, date_deadline=date_deadline,
|
act_type_xmlid=act_type_xmlid, date_deadline=date_deadline,
|
||||||
summary=summary, note=note, **act_values
|
summary=summary, note=note, **act_values
|
||||||
|
|
Loading…
Reference in New Issue