[IMP] im_chat, im_livechat : usability improvements like, adding smiley, replace uuid by session name in reporting, modify messages order for the session form view and disabled beep when you receveive your messages.

This commit is contained in:
Jérome Maes
2014-12-24 16:05:08 +01:00
parent 8667b2a57d
commit b4a733c10b
37 changed files with 143 additions and 61 deletions
+2 -2
View File
@@ -182,7 +182,7 @@ class im_chat_message(osv.Model):
Messages are sent to a session not to users.
"""
_name = 'im_chat.message'
_order = "id desc"
_order = "create_date asc"
_columns = {
'create_date': fields.datetime('Create Date', required=True, select=True),
'from_id': fields.many2one('res.users', 'Author'),
@@ -279,7 +279,7 @@ class im_chat_message(osv.Model):
domain = [("to_id.uuid", "=", uuid)]
if last_id:
domain.append(("id", "<", last_id));
return self.search_read(cr, uid, domain, ['id', 'create_date','to_id','from_id', 'type', 'message'], limit=limit, context=context)
return self.search_read(cr, uid, domain, ['id', 'create_date','to_id','from_id', 'type', 'message'], limit=limit, order="id desc", context=context)
return False
+113 -42
View File
@@ -1,87 +1,158 @@
<?xml version="1.0"?>
<openerp>
<data>
<data >
<!-- Smiley (html code) -->
<!-- Smileys -->
<record id="im_chat_smiley_smile" model="im_chat.shortcode">
<field name="source">:)</field>
<field name="substitution">&amp;#128522;</field>
<field name="description">Smile</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/smile.png'/&gt;</field>
<field name="description">Emoji Smile</field>
</record>
<record id="im_chat_smiley_sad" model="im_chat.shortcode">
<record id="im_chat_smiley_sad" model="im_chat.shortcode">
<field name="source">:(</field>
<field name="substitution">&amp;#9785;</field>
<field name="description">Sad</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/sad.png'/&gt;</field>
<field name="description">Emoji Sad</field>
</record>
<record id="im_chat_smiley_laugh" model="im_chat.shortcode">
<record id="im_chat_smiley_laugh" model="im_chat.shortcode">
<field name="source">:D</field>
<field name="substitution">&amp;#128517;</field>
<field name="description">Laugh</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/laugh.png'/&gt;</field>
<field name="description">Emoji Laugh</field>
</record>
<record id="im_chat_smiley_wink" model="im_chat.shortcode">
<record id="im_chat_smiley_wink" model="im_chat.shortcode">
<field name="source">;)</field>
<field name="substitution">&amp;#128521;</field>
<field name="description">Wink</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/wink.png'/&gt;</field>
<field name="description">Emoji Wink</field>
</record>
<record id="im_chat_smiley_speechless" model="im_chat.shortcode">
<record id="im_chat_smiley_stuck" model="im_chat.shortcode">
<field name="source">O_0</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/stuck_out_tongue.png'/&gt;</field>
<field name="description">Emoji Stuck Out Tongue Winking Eye</field>
</record>
<record id="im_chat_smiley_scream" model="im_chat.shortcode">
<field name="source">:@</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/scream.png'/&gt;</field>
<field name="description">Emoji Scream</field>
</record>
<record id="im_chat_smiley_neutral" model="im_chat.shortcode">
<field name="source">:|</field>
<field name="substitution">&amp;#128528;</field>
<field name="description">Speechless</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/neutral.png'/&gt;</field>
<field name="description">Emoji Speechless/Neutral face</field>
</record>
<record id="im_chat_smiley_cheeky" model="im_chat.shortcode">
<record id="im_chat_smiley_cheeky" model="im_chat.shortcode">
<field name="source">:p</field>
<field name="substitution">&amp;#128523;</field>
<field name="description">Cheeky</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/yum.png'/&gt;</field>
<field name="description">Emoji Cheeky</field>
</record>
<record id="im_chat_smiley_worried" model="im_chat.shortcode">
<field name="source">:s</field>
<field name="substitution">&amp;#128534;</field>
<field name="description">Worried</field>
</record>
<record id="im_chat_smiley_smirking" model="im_chat.shortcode">
<record id="im_chat_smiley_confused" model="im_chat.shortcode">
<field name="source">:/</field>
<field name="substitution">&amp;#128527;</field>
<field name="description">Smirking</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/confused.png'/&gt;</field>
<field name="description">Emoji Confused</field>
</record>
<record id="im_chat_smiley_surprised" model="im_chat.shortcode">
<record id="im_chat_smiley_open_mouth" model="im_chat.shortcode">
<field name="source">:O</field>
<field name="substitution">&amp;#128561;</field>
<field name="description">Surprised</field>
</record>
<record id="im_chat_smiley_kitten" model="im_chat.shortcode">
<field name="source">:kitten</field>
<field name="substitution">&amp;#128569;</field>
<field name="description">Kitten</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/open_mouth.png'/&gt;</field>
<field name="description">Emoji Open Mouth</field>
</record>
<record id="im_chat_smiley_heart" model="im_chat.shortcode">
<field name="source">&amp;lt;3</field>
<field name="substitution">&amp;#9829;</field>
<field name="description">Heart</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/heart.png'/&gt;</field>
<field name="description">Emoji Heart</field>
</record>
<!-- Other images -->
<record id="im_chat_smiley_thumbsup" model="im_chat.shortcode">
<field name="source">:+1</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/thumbsup.png'/&gt;</field>
<field name="description">Emoji Thumbs Up</field>
</record>
<record id="im_chat_smiley_thumbsdown" model="im_chat.shortcode">
<field name="source">:-1</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/thumbsdown.png'/&gt;</field>
<field name="description">Emoji Thumbs Down</field>
</record>
<record id="im_chat_smiley_kitten" model="im_chat.shortcode">
<field name="source">:kitten</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/cat.png'/&gt;</field>
<field name="description">Emoji Kitten</field>
</record>
<!-- Smiley image -->
<record id="im_chat_smiley_pinky" model="im_chat.shortcode">
<field name="source">:pinky</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/pinky.png'/&gt;</field>
<field name="description">Pinky</field>
<field name="description">Emoji Pinky</field>
</record>
<record id="im_chat_smiley_musti" model="im_chat.shortcode">
<field name="source">:musti</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/musti.png'/&gt;</field>
<field name="description">Musti</field>
<field name="description">Emoji Musti</field>
</record>
<record id="im_chat_smiley_man_with_turban" model="im_chat.shortcode">
<field name="source">:turban</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/man_with_turban.png'/&gt;</field>
<field name="description">Emoji Man With Turban</field>
</record>
<record id="im_chat_smiley_troll" model="im_chat.shortcode">
<field name="source">:troll</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/trollface.png'/&gt;</field>
<field name="description">Emoji Troll Face</field>
</record>
<record id="im_chat_smiley_boar" model="im_chat.shortcode">
<field name="source">:boar</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/boar.png'/&gt;</field>
<field name="description">Emoji Boar</field>
</record>
<record id="im_chat_smiley_poop" model="im_chat.shortcode">
<field name="source">:poop</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/poop.png'/&gt;</field>
<field name="description">Emoji Poop</field>
</record>
<record id="im_chat_smiley_cookie" model="im_chat.shortcode">
<field name="source">:cookie</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/cookie.png'/&gt;</field>
<field name="description">Emoji Cookie</field>
</record>
<record id="im_chat_smiley_postal_horn" model="im_chat.shortcode">
<field name="source">:postal_horn</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/postal_horn.png'/&gt;</field>
<field name="description">Emoji Postal Horn</field>
</record>
<record id="im_chat_smiley_ghost" model="im_chat.shortcode">
<field name="source">:ghost</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/ghost.png'/&gt;</field>
<field name="description">Emoji Ghost</field>
</record>
<record id="im_chat_smiley_beer" model="im_chat.shortcode">
<field name="source">:beer</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/beer.png'/&gt;</field>
<field name="description">Emoji Beer</field>
</record>
<record id="im_chat_smiley_man" model="im_chat.shortcode">
<field name="source">:man</field>
<field name="substitution">&lt;img src='/im_chat/static/src/img/man.png'/&gt;</field>
<field name="description">Emoji Man</field>
</record>
</data>
</openerp>
+3 -2
View File
@@ -169,8 +169,9 @@
border-radius: 3px;
}
.oe_im_chatview .oe_im_chatview_message_bubble .smiley{
font-size: 18px;
/* Smiley size */
.oe_im_chatview .oe_im_chatview_message_bubble img{
width: 18px;
}
.oe_im_chatview .oe_im_chatview_technical_bubble {
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

+9 -2
View File
@@ -130,7 +130,9 @@
var self = this;
var session_id = message.to_id[0];
var uuid = message.to_id[1];
if (! this.get("window_focus")) {
var from_id = message['from_id'] ? message['from_id'][0] : false;
var current_user = openerp.session ? openerp.session.uid : false;
if (! this.get("window_focus") && from_id != current_user) {
this.set("waiting_messages", this.get("waiting_messages") + 1);
}
var conv = this.sessions[uuid];
@@ -414,12 +416,17 @@
click_option_shortcut: function(){
openerp.client.action_manager.do_action({
type: 'ir.actions.act_window',
name : 'Shortcode',
res_model: 'im_chat.shortcode',
view_mode: 'tree,form',
view_type: 'tree',
views: [[false, 'list'], [false, 'form']],
target: "current",
target: "new",
limit: 80,
flags: {
action_buttons: true,
pager: true,
}
});
},
click_header: function(event){
+1 -2
View File
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- vim:fdn=3:
-->
<openerp>
<data>
<template id="assets_backend" name="im_chat assets" inherit_id="web.assets_backend">
+2 -2
View File
@@ -31,9 +31,9 @@
<field name="name">im_chat.shortcode.form</field>
<field name="model">im_chat.shortcode</field>
<field name="arch" type="xml">
<form string="Session Form" version="7.0">
<form string="Shortcodes">
<sheet>
<group colspan="2" col="2">
<group>
<field name="source"/>
<field name="substitution"/>
<field name="description"/>
+2 -2
View File
@@ -21,7 +21,7 @@
<field name="name">Sessions by day</field>
<field name="model_id">im_livechat.report</field>
<field name="domain">[('nbr_speakers','&gt;', 1)]</field>
<field name="context">{'group_by': ['start_date:day', 'uuid']}</field>
<field name="context">{'group_by': ['start_date:day', 'session_name']}</field>
<field name="is_default">v</field>
<field name="user_id" eval="False"/>
</record>
@@ -30,7 +30,7 @@
<field name="name">Last 24h stats</field>
<field name="model_id">im_livechat.report</field>
<field name="domain">[('start_date','&gt;', (context_today() - datetime.timedelta(days=1)).strftime('%Y-%m-%d') )]</field>
<field name="context">{'group_by': ['start_date:day', 'uuid']}</field>
<field name="context">{'group_by': ['start_date:day', 'session_name']}</field>
<field name="user_id" eval="False"/>
</record>
@@ -8,7 +8,8 @@ class im_livechat_report(osv.Model):
_auto = False
_description = "Livechat Support Report"
_columns = {
'uuid': fields.char('UUID', size=50, readonly=True),
'session_name': fields.char('Session Name', readonly=True),
'uuid': fields.char('UUID', readonly=True),
'start_date': fields.datetime('Start Date of session', readonly=True, help="Start date of the conversation"),
'start_date_hour': fields.char('Hour of start Date of session', readonly=True),
'duration': fields.float('Average duration', digits=(16,2), readonly=True, group_operator="avg", help="Duration of the conversation (in seconds)"),
@@ -22,7 +23,7 @@ class im_livechat_report(osv.Model):
'session_id': fields.many2one('im_chat.session', 'Session', readonly=True),
'channel_id': fields.many2one('im_livechat.channel', 'Channel', readonly=True),
}
_order = 'start_date, uuid'
_order = 'start_date, session_name'
def init(self, cr):
# Note : start_date_hour must be remove when the read_group will allow grouping on the hour of a datetime. Don't forget to change the view !
@@ -32,6 +33,7 @@ class im_livechat_report(osv.Model):
SELECT
min(M.id) as id,
S.uuid as uuid,
CONCAT(C.name, ' / ', S.id) as session_name,
S.create_date as start_date,
to_char(date_trunc('hour', S.create_date), 'YYYY-MM-DD HH24:MI:SS') as start_date_hour,
EXTRACT('epoch' from ((SELECT (max(create_date)-min(create_date)) FROM im_chat_message WHERE to_id=S.id AND from_id = U.id))) as time_in_session,
@@ -42,12 +44,14 @@ class im_livechat_report(osv.Model):
count(M.id) as nbr_user_messages,
CAST(S.feedback_rating AS INT) as rating,
U.id as user_id,
S.channel_id as channel_id
S.channel_id as channel_id,
S.id as session_id
FROM im_chat_message M
LEFT JOIN im_chat_session S on (S.id = M.to_id)
LEFT JOIN res_users U on (U.id = M.from_id)
LEFT JOIN im_livechat_channel C on (S.channel_id = C.id)
WHERE S.channel_id IS NOT NULL
GROUP BY U.id, M.to_id, S.id
GROUP BY U.id, M.to_id, S.id, C.name, S.uuid
)
""")
@@ -7,7 +7,7 @@
<field name="model">im_livechat.report</field>
<field name="arch" type="xml">
<pivot string="Livechat Support Statistics" disable_linking="True">
<field name="uuid" type="row"/>
<field name="session_name" type="row"/>
<field name="duration" type="measure"/>
<field name="nbr_messages" type="measure"/>
<field name="time_to_answer" type="measure"/>
@@ -20,7 +20,7 @@
<field name="model">im_livechat.report</field>
<field name="arch" type="xml">
<graph string="Livechat Support Statistics">
<field name="uuid"/>
<field name="session_name"/>
<field name="nbr_messages" type="measure"/>
</graph>
</field>
@@ -35,7 +35,7 @@
<filter name="treated_session" string="Treated sessions" domain="[('nbr_speakers','&gt;', 1)]"/>
<filter name="last_24h" string="Last 24h" domain="[('start_date','&gt;', (context_today() - datetime.timedelta(days=1)).strftime('%%Y-%%m-%%d') )]"/>
<group expand="0" string="Group By...">
<filter name="group_by_session" string="Session" domain="[]" context="{'group_by':'uuid'}"/>
<filter name="group_by_session" string="Session" domain="[]" context="{'group_by':'session_name'}"/>
<filter name="group_by_channel" string="Channel" domain="[]" context="{'group_by':'channel_id'}"/>
<filter name="group_by_user" string="Operator" domain="[('user_id','!=', False)]" context="{'group_by':'user_id'}"/>
<separator orientation="vertical" />