Skip to content

Commit 815bece

Browse files
committed
[IMP] report: open chat window post upgrade
Chat window with the report will be opened by default after the upgrade, only for the admin user.
1 parent 71bd87f commit 815bece

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/util/report.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def html_escape(text):
6464
from openerp.addons.base.module.module import MyWriter
6565

6666
from .exceptions import MigrationError
67-
from .misc import has_enterprise, split_osenv, version_gte
67+
from .misc import has_enterprise, split_osenv, version_between, version_gte
6868
from .orm import env, get_admin_channel, guess_admin_id
6969

7070
migration_reports = {}
@@ -286,6 +286,18 @@ def ref(xid):
286286
except Exception:
287287
_logger.warning("Cannot announce message", exc_info=True)
288288

289+
# Chat window with the report will be open post-upgrade for the admin user
290+
if version_between("9.0", "saas~18.2"):
291+
channel_member_model = (
292+
"discuss.channel.member"
293+
if version_gte("saas~16.3")
294+
else "mail.channel.member"
295+
if version_gte("16.0")
296+
else "mail.channel.partner"
297+
)
298+
domain = [("partner_id", "=", user.partner_id.id), ("channel_id", "=", recipient.id)]
299+
registry[channel_member_model].search(domain)[:1].with_context(ctx).fold_state = "open"
300+
289301

290302
def get_anchor_link_to_record(model, id, name, action_id=None):
291303
_validate_model(model)

0 commit comments

Comments
 (0)