Skip to content

Commit

Permalink
Merge pull request #4160 from Tecnativa/15.0-ou_fix-mail-channel_part…
Browse files Browse the repository at this point in the history
…ners-pinning

[15.0][OU-FIX] mail: Make sure channel partners are pinned
  • Loading branch information
pedrobaeza authored Oct 13, 2023
2 parents 8c5aeac + 0aec685 commit 052eb18
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions openupgrade_scripts/scripts/mail/15.0.1.5/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,16 @@ def _migrate_mail_templates(env):
tmpl_lang.body_html = mako_html_to_qweb(tmpl_lang.body_html)


def _pin_mail_channel_partners(env):
"""Since this version, a check is performed on JS side on discuss initialization
for unsubscribing from channels that are not pinned, so we should fill the DB, which
by default put a NULL value on that field, with a True value.
"""
openupgrade.logged_query(
env.cr, "UPDATE mail_channel_partner SET is_pinned=True WHERE is_pinned IS NULL"
)


@openupgrade.migrate()
def migrate(env, version):
openupgrade.load_data(env.cr, "mail", "15.0.1.5/noupdate_changes.xml")
Expand All @@ -243,3 +253,4 @@ def migrate(env, version):
)
finish_migration_to_mail_group(env)
_migrate_mail_templates(env)
_pin_mail_channel_partners(env)

0 comments on commit 052eb18

Please sign in to comment.