summaryrefslogtreecommitdiff
path: root/addons/web_settings_dashboard/controllers
diff options
context:
space:
mode:
authorParth Gajjar <pga@openerp.com>2015-06-17 17:49:17 +0530
committerDavid Monjoie <dmo@odoo.com>2015-09-04 13:03:21 +0200
commitc6a0af45efb6b30fc67af6645a2d71d58e8f4065 (patch)
tree37d091b674cfcafb5671e9cbf9ee4b06e442496a /addons/web_settings_dashboard/controllers
parentbd0c6a2b242107be49df6b220da5218eceaf91e3 (diff)
[ADD] web_settings_dashboard: Settings Dashboard
Diffstat (limited to 'addons/web_settings_dashboard/controllers')
-rw-r--r--addons/web_settings_dashboard/controllers/__init__.py2
-rw-r--r--addons/web_settings_dashboard/controllers/main.py28
2 files changed, 30 insertions, 0 deletions
diff --git a/addons/web_settings_dashboard/controllers/__init__.py b/addons/web_settings_dashboard/controllers/__init__.py
new file mode 100644
index 00000000000..a84d81a791b
--- /dev/null
+++ b/addons/web_settings_dashboard/controllers/__init__.py
@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+import main
diff --git a/addons/web_settings_dashboard/controllers/main.py b/addons/web_settings_dashboard/controllers/main.py
new file mode 100644
index 00000000000..35db119ae14
--- /dev/null
+++ b/addons/web_settings_dashboard/controllers/main.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+
+from openerp import http
+from openerp.http import request
+
+
+class WebSettingsDashboard(http.Controller):
+
+ @http.route('/web_settings_dashboard/data', type='json', auth='user')
+ def web_settings_dashboard_data(self, **kw):
+
+ installed_apps = request.env['ir.module.module'].search_count([
+ ('application', '=', True),
+ ('state', 'in', ['installed', 'to upgrade', 'to remove'])
+ ])
+ active_users = request.env['res.users'].search_count([('active', '=', True), ('login_date', '!=', False)])
+ pending_users = request.env['res.users'].search([('login_date', '=', False)], order="create_date desc")
+
+ return {
+ 'apps': {
+ 'installed_apps': installed_apps
+ },
+ 'users_info': {
+ 'active_users': active_users,
+ 'pending_users': zip(pending_users.mapped('id'), pending_users.mapped('login')),
+ 'user_form_view_id': request.env['ir.model.data'].xmlid_to_res_id("base.view_users_form"),
+ },
+ }