Skip to content

[18.0][FIX] mail_activity_team: remaining calls to previous refactored get_default_team_id method#168

Closed
StefanRijnhart wants to merge 1 commit intoOCA:18.0from
StefanRijnhart:18.0-mail_activity_team-fix_get_default_team_call
Closed

[18.0][FIX] mail_activity_team: remaining calls to previous refactored get_default_team_id method#168
StefanRijnhart wants to merge 1 commit intoOCA:18.0from
StefanRijnhart:18.0-mail_activity_team-fix_get_default_team_call

Conversation

@StefanRijnhart
Copy link
Copy Markdown
Member

Regression of #149

Fixes

  File "/mnt/data/odoo-addons-dir/mail_activity_team/wizard/mail_activity_schedule.py", line 53, in _onchange_activity_team_user_id
    and self.activity_team_user_id in self.activity_team_id.member_ids
  File "/opt/odoo/odoo/fields.py", line 3113, in __get__
    return super().__get__(records, owner)
  File "/opt/odoo/odoo/fields.py", line 1244, in __get__
    self.recompute(record)
  File "/opt/odoo/odoo/fields.py", line 1471, in recompute
    apply_except_missing(self.compute_value, recs)
  File "/opt/odoo/odoo/fields.py", line 1444, in apply_except_missing
    func(records)
  File "/opt/odoo/odoo/fields.py", line 1493, in compute_value
    records._compute_field_value(self)
  File "/opt/odoo/odoo/models.py", line 5302, in _compute_field_value
    fields.determine(field.compute, self)
  File "/opt/odoo/odoo/fields.py", line 110, in determine
    return needle(*args)
  File "/mnt/data/odoo-addons-dir/mail_activity_team/wizard/mail_activity_schedule.py", line 30, in _compute_activity_team_id
    ]._get_default_team_id(
TypeError: MailActivity._get_default_team_id() takes 1 positional argument but 3 were given

…default_team method

Regression of OCA#149

Fixes
```
  File "/mnt/data/odoo-addons-dir/mail_activity_team/wizard/mail_activity_schedule.py", line 53, in _onchange_activity_team_user_id
    and self.activity_team_user_id in self.activity_team_id.member_ids
  File "/opt/odoo/odoo/fields.py", line 3113, in __get__
    return super().__get__(records, owner)
  File "/opt/odoo/odoo/fields.py", line 1244, in __get__
    self.recompute(record)
  File "/opt/odoo/odoo/fields.py", line 1471, in recompute
    apply_except_missing(self.compute_value, recs)
  File "/opt/odoo/odoo/fields.py", line 1444, in apply_except_missing
    func(records)
  File "/opt/odoo/odoo/fields.py", line 1493, in compute_value
    records._compute_field_value(self)
  File "/opt/odoo/odoo/models.py", line 5302, in _compute_field_value
    fields.determine(field.compute, self)
  File "/opt/odoo/odoo/fields.py", line 110, in determine
    return needle(*args)
  File "/mnt/data/odoo-addons-dir/mail_activity_team/wizard/mail_activity_schedule.py", line 30, in _compute_activity_team_id
    ]._get_default_team_id(
TypeError: MailActivity._get_default_team_id() takes 1 positional argument but 3 were given
```
Comment on lines +37 to +43
activity = self.env["mail.activity"].new(
values={
"res_model_id": wizard.sudo().res_model_id.id,
"user_id": wizard.activity_user_id.id,
},
)
wizard.activity_team_id = activity._get_default_team_id()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not convinced that this is a better pattern than adding parameters to the method?

Before activity_team_user_id was used instead of activity_user_id. Is this intendet?

Copy link
Copy Markdown
Member Author

@StefanRijnhart StefanRijnhart Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't matter whether to use activity_user_id or activity_team_user_id. I believe the dedicated team user fields are only introduced to apply the domain on team membership, but fundamentally the fields are related and kept in sync by Odoo.

What you can do is take the additional test coverage of this PR and copy it into your branch so that we can see how it looks on your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants