Skip to content

Commit

Permalink
Merge pull request #4762 from ForgeFlow/17.0-fix-mail-outgoing
Browse files Browse the repository at this point in the history
[17.0][OU-FIX] mail: set outgoing emails
  • Loading branch information
pedrobaeza authored Feb 25, 2025
2 parents 7b94bad + e60d547 commit 69b349a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions openupgrade_scripts/scripts/mail/17.0.1.15/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,25 @@ def _mail_template_convert_report_template_m2o_to_m2m(env):
)


def _fill_mail_message_outgoing(env):
# set outgoing messages
group = env.ref("base.group_user")
openupgrade.logged_query(
env.cr,
f"""
UPDATE mail_message mm
SET message_type = 'email_outgoing'
FROM mail_mail mail, res_partner rp
JOIN res_users ru ON ru.partner_id = rp.id
JOIN res_groups_users_rel rel ON rel.uid = ru.id
AND rel.gid = {group.id}
WHERE mm.message_type = 'email'
AND mm.message_id like '%-openerp-' || mm.res_id || '-' || mm.model || '@%'
AND (mm.author_id = rp.id OR mail.mail_message_id = mm.id)
""",
)


def _mail_activity_plan_template(env):
"""If the OCA mail_activity_plan module was installed, we create the
mail.activity.plan.template records.
Expand Down Expand Up @@ -140,4 +159,5 @@ def migrate(env, version):
_fill_res_company_alias_domain_id(env)
_mail_alias_fill_alias_full_name(env)
_mail_template_convert_report_template_m2o_to_m2m(env)
_fill_mail_message_outgoing(env)
_mail_activity_plan_template(env)
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ mail / mail.shortcode / message_ids (many2one) : DEL re
# NOTHING TO DO: following commit https://github.com/odoo/odoo/pull/138938/commits/94b71f74ba20733110c123e1c02df9a384fe9d74

mail / mail.message / message_type (selection) : selection_keys is now '['auto_comment', 'comment', 'email', 'email_outgoing', 'notification', 'user_notification']' ('['comment', 'email', 'notification', 'user_notification']')
# NOTHING TO DO: well when odoo backport https://github.com/odoo/odoo/pull/149576 in 15, nothing to do either because there is no way to detect and fill for 'auto_common' and 'email_outgoing'
# NOTHING TO DO (auto_comment): well when odoo backport https://github.com/odoo/odoo/pull/149576 in 15, nothing to do because there is no way to detect and fill for 'auto_comment'
# DONE (email_outgoing): post-migration: set 'email_outgoing' emails using message_id

mail / mail.message / pinned_at (datetime) : NEW
# NOTHING TO DO: new feature to pin message
Expand Down

0 comments on commit 69b349a

Please sign in to comment.