Skip to content

Commit

Permalink
Merge PR #689 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by moylop260
  • Loading branch information
OCA-git-bot committed Sep 13, 2024
2 parents d34a8af + 17ae4f6 commit 1fbe170
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion auth_session_timeout/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"maintainer": "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/server-auth",
"category": "Tools",
"version": "15.0.1.0.0",
"version": "15.0.1.0.1",
"license": "AGPL-3",
"data": ["data/ir_config_parameter_data.xml"],
"installable": True,
Expand Down
4 changes: 3 additions & 1 deletion auth_session_timeout/data/ir_config_parameter_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
</record>
<record id="inactive_session_time_out_ignored_url" model="ir.config_parameter">
<field name="key">inactive_session_time_out_ignored_url</field>
<field name="value">/calendar/notify,/longpolling/poll</field>
<field
name="value"
>/calendar/notify,/longpolling/poll,/longpolling/im_status</field>
</record>
</odoo>
28 changes: 28 additions & 0 deletions auth_session_timeout/migrations/15.0.1.0.1/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import logging

from odoo import SUPERUSER_ID, api

_logger = logging.getLogger(__name__)


def migrate(cr, version):
add_controller_to_parameter(cr)


def add_controller_to_parameter(cr):
"""Add /longpolling/im_status because it is executed several times (every 50 seconds)"""
env = api.Environment(cr, SUPERUSER_ID, {})
new_url = "/longpolling/im_status"
ignored_path_key = "inactive_session_time_out_ignored_url"
param = env["ir.config_parameter"]
old_value = param.get_param(ignored_path_key, "")
if new_url in old_value:
_logger.info(
"%s is included in the parameter %s already.", new_url, ignored_path_key
)
return
new_value = "%s,%s" % (old_value, new_url)
param.set_param(ignored_path_key, new_value)
_logger.info(
"%s was added to the parameter %s successfully.", new_url, ignored_path_key
)

0 comments on commit 1fbe170

Please sign in to comment.