From 8455aba5234c98f8d215d80958e9424ea7523b4a Mon Sep 17 00:00:00 2001 From: Dhinesh D Date: Mon, 13 Jun 2016 13:09:12 +0530 Subject: [PATCH] [9.0] port - inactive_session_timeout --- inactive_session_timeout/README.rst | 1 + inactive_session_timeout/__init__.py | 4 +++ inactive_session_timeout/__openerp__.py | 31 +++++-------------- .../data/ir_config_parameter_data.xml | 8 +++-- inactive_session_timeout/models/__init__.py | 4 +++ .../models/ir_config_parameter.py | 26 +++------------- inactive_session_timeout/models/res_users.py | 26 +++------------- inactive_session_timeout/tests/__init__.py | 6 ++++ .../tests/test_ir_config_parameter.py | 28 +++++++++++++++++ 9 files changed, 64 insertions(+), 70 deletions(-) create mode 100644 inactive_session_timeout/tests/__init__.py create mode 100644 inactive_session_timeout/tests/test_ir_config_parameter.py diff --git a/inactive_session_timeout/README.rst b/inactive_session_timeout/README.rst index 08e47d0d9..4c9249886 100644 --- a/inactive_session_timeout/README.rst +++ b/inactive_session_timeout/README.rst @@ -31,6 +31,7 @@ Contributors ------------ * Cédric Pigeon +* Dhinesh D Maintainer ---------- diff --git a/inactive_session_timeout/__init__.py b/inactive_session_timeout/__init__.py index a0fdc10fe..9b1fb35b0 100644 --- a/inactive_session_timeout/__init__.py +++ b/inactive_session_timeout/__init__.py @@ -1,2 +1,6 @@ # -*- coding: utf-8 -*- +# (c) 2015 ACSONE SA/NV, Dhinesh D + +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + from . import models diff --git a/inactive_session_timeout/__openerp__.py b/inactive_session_timeout/__openerp__.py index 8b6180514..a7acc836d 100644 --- a/inactive_session_timeout/__openerp__.py +++ b/inactive_session_timeout/__openerp__.py @@ -1,37 +1,20 @@ # -*- coding: utf-8 -*- -############################################################################## +# (c) 2015 ACSONE SA/NV, Dhinesh D + +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -# This file is part of inactive_session_timeout, an Odoo module. -# -# Copyright (c) 2015 ACSONE SA/NV () -# -# inactive_session_timeout is free software: you can redistribute it -# and/or modify it under the terms of the GNU Affero General Public License -# as published by the Free Software Foundation, either version 3 of -# the License, or (at your option) any later version. -# -# inactive_session_timeout is distributed in the hope that it will -# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the -# GNU Affero General Public License -# along with inactive_session_timeout. -# If not, see . -# -############################################################################## { 'name': "Inactive Sessions Timeout", 'summary': """ This module disable all inactive sessions since a given delay""", - 'author': "ACSONE SA/NV", "Odoo Community Association (OCA)" + 'author': "ACSONE SA/NV, Dhinesh D, Odoo Community Association (OCA)", + 'maintainer': 'Odoo Community Association (OCA)', 'website': "http://acsone.eu", 'category': 'Tools', - 'version': '8.0.1.0.0', + 'version': '9.0.1.0.0', 'license': 'AGPL-3', 'depends': [ @@ -41,5 +24,5 @@ 'data': [ 'data/ir_config_parameter_data.xml' ], - 'installable': False, + 'installable': True, } diff --git a/inactive_session_timeout/data/ir_config_parameter_data.xml b/inactive_session_timeout/data/ir_config_parameter_data.xml index e87e983c8..96b0194bf 100644 --- a/inactive_session_timeout/data/ir_config_parameter_data.xml +++ b/inactive_session_timeout/data/ir_config_parameter_data.xml @@ -1,6 +1,10 @@ - + + inactive_session_time_out_delay @@ -14,4 +18,4 @@ /calendar/notify,/longpolling/poll - + diff --git a/inactive_session_timeout/models/__init__.py b/inactive_session_timeout/models/__init__.py index 9893cc6a7..0c6063031 100644 --- a/inactive_session_timeout/models/__init__.py +++ b/inactive_session_timeout/models/__init__.py @@ -1,3 +1,7 @@ # -*- coding: utf-8 -*- +# (c) 2015 ACSONE SA/NV, Dhinesh D + +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + from . import res_users from . import ir_config_parameter diff --git a/inactive_session_timeout/models/ir_config_parameter.py b/inactive_session_timeout/models/ir_config_parameter.py index b68585027..69a7003f0 100644 --- a/inactive_session_timeout/models/ir_config_parameter.py +++ b/inactive_session_timeout/models/ir_config_parameter.py @@ -1,26 +1,8 @@ # -*- coding: utf-8 -*- -############################################################################## - -# This file is part of inactive_session_timeout, an Odoo module. -# -# Copyright (c) 2015 ACSONE SA/NV () -# -# inactive_session_timeout is free software: you can redistribute it -# and/or modify it under the terms of the GNU Affero General Public License -# as published by the Free Software Foundation, either version 3 of -# the License, or (at your option) any later version. -# -# inactive_session_timeout is distributed in the hope that it will -# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the -# GNU Affero General Public License -# along with inactive_session_timeout. -# If not, see . -# -############################################################################## +# (c) 2015 ACSONE SA/NV, Dhinesh D + +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + from openerp import models, api, tools, SUPERUSER_ID diff --git a/inactive_session_timeout/models/res_users.py b/inactive_session_timeout/models/res_users.py index b713c4f16..95a137df9 100644 --- a/inactive_session_timeout/models/res_users.py +++ b/inactive_session_timeout/models/res_users.py @@ -1,26 +1,8 @@ # -*- coding: utf-8 -*- -############################################################################## - -# This file is part of inactive_session_timeout, an Odoo module. -# -# Copyright (c) 2015 ACSONE SA/NV () -# -# inactive_session_timeout is free software: you can redistribute it -# and/or modify it under the terms of the GNU Affero General Public License -# as published by the Free Software Foundation, either version 3 of -# the License, or (at your option) any later version. -# -# inactive_session_timeout is distributed in the hope that it will -# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the -# GNU Affero General Public License -# along with inactive_session_timeout. -# If not, see . -# -############################################################################## +# (c) 2015 ACSONE SA/NV, Dhinesh D + +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + from openerp import models from openerp import http diff --git a/inactive_session_timeout/tests/__init__.py b/inactive_session_timeout/tests/__init__.py new file mode 100644 index 000000000..7ae3d0692 --- /dev/null +++ b/inactive_session_timeout/tests/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# (c) 2015 ACSONE SA/NV, Dhinesh D + +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import test_ir_config_parameter diff --git a/inactive_session_timeout/tests/test_ir_config_parameter.py b/inactive_session_timeout/tests/test_ir_config_parameter.py new file mode 100644 index 000000000..f2aa42152 --- /dev/null +++ b/inactive_session_timeout/tests/test_ir_config_parameter.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# (c) 2015 ACSONE SA/NV, Dhinesh D + +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +import threading + +from openerp.tests import common +import openerp + + +class TestIrConfigParameter(common.TransactionCase): + + def setUp(self): + super(TestIrConfigParameter, self).setUp() + self.db = openerp.tools.config['db_name'] + if not self.db and hasattr(threading.current_thread(), 'dbname'): + self.db = threading.current_thread().dbname + self.param_obj = self.env['ir.config_parameter'] + self.data_obj = self.env['ir.model.data'] + self.delay = self.env.ref( + 'inactive_session_timeout.inactive_session_time_out_delay') + + def test_check_delay(self): + delay, urls = self.param_obj.get_session_parameters(self.db) + self.assertEqual(delay, int(self.delay.value)) + self.assertIsInstance(delay, int) + self.assertIsInstance(urls, list)