-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IMP] report: open chat window post upgrade #218
base: master
Are you sure you want to change the base?
Conversation
src/util/report.py
Outdated
@@ -286,6 +286,21 @@ def ref(xid): | |||
except Exception: | |||
_logger.warning("Cannot announce message", exc_info=True) | |||
|
|||
# Chat window with the report will be open post-upgrade for the admin | |||
if version_gte("9.0"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can get rid of one level of if
s in favor of a dictionary with versions, but I thought it's going to be less readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can get rid of this because we do not support upgrading to 9.0 already :)
src/util/report.py
Outdated
[("partner_id", "=", user.partner_id.id), ("channel_id", "=", recipient.id)] | ||
)[0].with_context(ctx).fold_state = "open" | ||
except Exception: | ||
_logger.warning("Cannot open chat window", exc_info=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to log anything, in any case if we do logging exception info is better done with _logger.exception
;)
_logger.warning("Cannot open chat window", exc_info=True) | |
pass |
Maybe use contextlib.suppress
and be more specific: what kind of exception we get here? and why?
ecf96b7
to
4926bd1
Compare
upgradeci retry with always only hr in all versions |
4926bd1
to
5284593
Compare
src/util/report.py
Outdated
try: | ||
registry[channel_member_model].search( | ||
[("partner_id", "=", user.partner_id.id), ("channel_id", "=", recipient.id)] | ||
)[0].with_context(ctx).fold_state = "open" | ||
except Exception: | ||
_logger.exception("Could not open chat window with upgrade report.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1/ extract the domain in a variable
2/ avoid exception by not using [0]
try: | |
registry[channel_member_model].search( | |
[("partner_id", "=", user.partner_id.id), ("channel_id", "=", recipient.id)] | |
)[0].with_context(ctx).fold_state = "open" | |
except Exception: | |
_logger.exception("Could not open chat window with upgrade report.") | |
domain = [("partner_id", "=", user.partner_id.id), ("channel_id", "=", recipient.id)] | |
registry[channel_member_model].search(domain)[:1].with_context(ctx).fold_state = "open" |
5284593
to
f3e72ee
Compare
src/util/report.py
Outdated
@@ -286,6 +286,12 @@ def ref(xid): | |||
except Exception: | |||
_logger.warning("Cannot announce message", exc_info=True) | |||
|
|||
# Chat window with the report will be open post-upgrade for the admin user | |||
if not version_gte("saas~18.2"): | |||
channel_member_model = "discuss.channel.member" if version_gte("saas~16.3") else "mail.channel.member" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
channel_member_model = "discuss.channel.member" if version_gte("saas~16.3") else "mail.channel.member" | |
channel_member_model = "discuss.channel.member" if version_gte("saas~16.3") else "mail.channel.member" if version_gte("16.0") else "mail.channel.partner" |
src/util/report.py
Outdated
@@ -286,6 +286,12 @@ def ref(xid): | |||
except Exception: | |||
_logger.warning("Cannot announce message", exc_info=True) | |||
|
|||
# Chat window with the report will be open post-upgrade for the admin user | |||
if not version_gte("saas~18.2"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fold_state
appears in v9
if not version_gte("saas~18.2"): | |
if version_between("9.0", "saas~18.2"): |
Chat window with the report will be opened by default after the upgrade, only for the admin user.
f3e72ee
to
815bece
Compare
Chat window with the report will be opened by default after the upgrade, only for the admin user.