From d6cd293e17072e3d7a31f70adaded4c6f2afcbff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Maes?=
Date: Tue, 18 Nov 2014 13:47:32 +0100
Subject: [PATCH] [IMP] im_livechat : add nbr_sessions field on channel and
modifications of various views
---
addons/im_livechat/im_livechat.py | 9 +
addons/im_livechat/views/im_livechat_view.xml | 213 ++++++++++--------
2 files changed, 132 insertions(+), 90 deletions(-)
diff --git a/addons/im_livechat/im_livechat.py b/addons/im_livechat/im_livechat.py
index dafc2ed4c6f..cfc9a428873 100644
--- a/addons/im_livechat/im_livechat.py
+++ b/addons/im_livechat/im_livechat.py
@@ -85,6 +85,13 @@ class im_livechat_channel(osv.Model):
"/im_livechat/support/%s/%i" % (cr.dbname, record.id)
return res
+ def _compute_nbr_session(self, cr, uid, ids, name, arg, context=None):
+ res = {}
+ for record in self.browse(cr, uid, ids, context=context):
+ res[record.id] = len(record.session_ids)
+ return res
+
+
_columns = {
'name': fields.char(string="Channel Name", size=200, required=True),
'user_ids': fields.many2many('res.users', 'im_livechat_channel_im_user', 'channel_id', 'user_id', string="Users"),
@@ -114,6 +121,8 @@ class im_livechat_channel(osv.Model):
help="Small-sized photo of the group. It is automatically "\
"resized as a 64x64px image, with aspect ratio preserved. "\
"Use this field anywhere a small image is required."),
+ 'session_ids' : fields.one2many('im_chat.session', 'channel_id', 'Sessions'),
+ 'nbr_session' : fields.function(_compute_nbr_session, type='integer', string='Number of session', store=False),
}
def _default_user_ids(self, cr, uid, context=None):
diff --git a/addons/im_livechat/views/im_livechat_view.xml b/addons/im_livechat/views/im_livechat_view.xml
index ee23c404f44..bae7b59f5b5 100644
--- a/addons/im_livechat/views/im_livechat_view.xml
+++ b/addons/im_livechat/views/im_livechat_view.xml
@@ -1,9 +1,95 @@
-
+
+
+
+ History
+ im_chat.session
+ form
+ list,form
+ [('channel_id', '!=', None)]
+ {'group_by': ['channel_id', 'create_date:month']}
+
-
+
+ im_chat.session.search
+ im_chat.session
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ im_chat.session.tree
+ im_chat.session
+
+
+
+
+
+
+
+
+
+
+
+ im_chat.session.form
+ im_chat.session
+
+
+
+
+
+
+
+
+ Sessions
+ im_chat.session
+ list,form
+ [('channel_id','in',[active_id])]
+ {
+ 'search_default_channel_id': [active_id],
+ 'default_channel_id': active_id,
+ }
+
+
+
+
+
Live Chat Channels
im_livechat.channel
@@ -21,8 +107,6 @@
-
-
support_channel.kanban
@@ -33,21 +117,34 @@
+
-
-
-
-
-
+
+
+
+
+
@@ -116,85 +216,18 @@
For website built with Odoo CMS, please install the website_livechat module. Then go to Settings > Website Settings and select the Live Chat Channel you want to add on your website.
-
-
-
- History
- im_chat.session
- form
- list,form
- [('channel_id', '!=', None)]
- {'group_by': ['channel_id', 'create_date:month']}
-
+
+
+
-
- im_chat.session.search
- im_chat.session
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- im_chat.session.tree
- im_chat.session
-
-
-
-
-
-
-
-
-
-
-
-
- im_chat.session.form
- im_chat.session
-
-
-
-
+