Skip to content

Commit ebd6876

Browse files
committed
[IMP] util/orm: ensure working of auto-subscribe for upgrade purposes
At the end of an upgrade, the default '#Administrators' channel is sometimes used to send upgrade-related information to admins, and a new one is created if the default one is deleted. In cases where this new channel is created, the auto-subscribe feature is used to join admins to the channel. The community counterpart of this commit adds a boolean that needs to be enabled in order to auto-subscribe users. The goal of this commit is to ensure that the auto-subscribe of users is correctly handled in such cases. community: odoo/odoo#247715 enterprise: odoo/enterprise#117048 upgrade: odoo/upgrade#9436 task-4804991
1 parent 788ebfe commit ebd6876

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/util/orm.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ def get_admin_channel(cr):
108108
]
109109
if "public" in e[channel_model_name]._fields:
110110
search_rules.append(("public", "=", "groups"))
111+
if "auto_join" in e[channel_model_name]._fields:
112+
search_rules.append(("auto_join", "=", True))
111113
admin_channel = next(
112114
iter(e[channel_model_name].search(search_rules).sorted(lambda c: "admin" not in c.name.lower()) or []),
113115
None,
@@ -121,6 +123,8 @@ def get_admin_channel(cr):
121123
}
122124
if "public" in e[channel_model_name]._fields:
123125
channel_values["public"] = "groups"
126+
if "auto_join" in e[channel_model_name]._fields:
127+
channel_values["auto_join"] = True
124128
admin_channel = e[channel_model_name].create(channel_values)
125129

126130
e["ir.model.data"].create(

0 commit comments

Comments
 (0)