<commit_before># Copyright 2021 Tecnativa - <NAME>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models


class MailActivityMixin(models.AbstractModel):
    _inherit = "mail.activity.mixin"

    def activity_schedule(
        self, act_type_xmlid="", date_deadline=None, summary="", note="", **act_values
    ):
        """With automatic activities, the user onchange won't act so we must
        ensure the right group is set and no exceptions are raised due to
        user-team missmatch. We can hook onto `act_values` dict as it's passed
        to the create activity method.
        """
        user_id = act_values.get("user_id")
        if user_id:
            team = (
                self.env["mail.activity"]
                .with_context(default_res_model=self._name,)
                ._get_default_team_id(user_id=user_id)
            )
            # Even if it comes empty, we don't want to mismatch the user's team
            act_values.update({"team_id": team.id})
        return super().activity_schedule(
            act_type_xmlid=act_type_xmlid,
            date_deadline=date_deadline,
            summary=summary,
            note=note,
            **act_values
        )<commit_msg>[IMP] mail_activity_team: black, isort, prettier<commit_after># Copyright 2021 Tecnativa - <NAME>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models


class MailActivityMixin(models.AbstractModel):
    _inherit = "mail.activity.mixin"

    def activity_schedule(
        self, act_type_xmlid="", date_deadline=None, summary="", note="", **act_values
    ):
        """With automatic activities, the user onchange won't act so we must
        ensure the right group is set and no exceptions are raised due to
        user-team missmatch. We can hook onto `act_values` dict as it's passed
        to the create activity method.
        """
        user_id = act_values.get("user_id")
        if user_id:
            team = (
                self.env["mail.activity"]
                .with_context(
                    default_res_model=self._name,
                )
                ._get_default_team_id(user_id=user_id)
            )
            # Even if it comes empty, we don't want to mismatch the user's team
            act_values.update({"team_id": team.id})
        return super().activity_schedule(
            act_type_xmlid=act_type_xmlid,
            date_deadline=date_deadline,
            summary=summary,
            note=note,
            **act_values
        )
{'fraction_non_alphanumeric': 0.09395711500974659, 'fraction_numerical': 0.004678362573099415, 'mean_word_length': 2.171817058096415, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4885015', 'n_tokens_mistral': 763, 'n_tokens_neox': 727, 'n_words': 197}