summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérome Maes <jem@openerp.com>2015-03-23 14:35:35 +0100
committerJérome Maes <jem@openerp.com>2015-03-23 14:49:23 +0100
commitc6ff080e2b84d205bc1c1657566ea1824764e4af (patch)
tree5ae9afe7bcf6f9615c2fc758adf35aaec09c0e60
parent033ae180b1132161a2708330f30bc3bdc0c924f7 (diff)
[FIX] im_livechat : send rating to the operator once the anonymous person close its conversation.
-rw-r--r--addons/im_livechat/im_livechat_data.xml20
-rw-r--r--addons/im_livechat/static/src/js/im_livechat.js1
-rw-r--r--addons/rating/views/rating_view.xml5
3 files changed, 23 insertions, 3 deletions
diff --git a/addons/im_livechat/im_livechat_data.xml b/addons/im_livechat/im_livechat_data.xml
index 8394d25c16d..7a97ae788e1 100644
--- a/addons/im_livechat/im_livechat_data.xml
+++ b/addons/im_livechat/im_livechat_data.xml
@@ -56,5 +56,25 @@
</record>
+ <!-- Smiley for rating to be displayed in the conversation -->
+ <record id="im_livechat_rating_0" model="im_chat.shortcode">
+ <field name="source">:rating_0</field>
+ <field name="substitution">&lt;img src='/rating/static/src/img/rating_0.png'/&gt;</field>
+ <field name="description">Rating Smiley Bad</field>
+ </record>
+
+ <record id="im_livechat_rating_5" model="im_chat.shortcode">
+ <field name="source">:rating_5</field>
+ <field name="substitution">&lt;img src='/rating/static/src/img/rating_5.png'/&gt;</field>
+ <field name="description">Rating Smiley Okay</field>
+ </record>
+
+ <record id="im_livechat_rating_10" model="im_chat.shortcode">
+ <field name="source">:rating_10</field>
+ <field name="substitution">&lt;img src='/rating/static/src/img/rating_10.png'/&gt;</field>
+ <field name="description">Rating Smiley Good</field>
+ </record>
+
+
</data>
</openerp> \ No newline at end of file
diff --git a/addons/im_livechat/static/src/js/im_livechat.js b/addons/im_livechat/static/src/js/im_livechat.js
index 7841e3b7803..07ee22002ae 100644
--- a/addons/im_livechat/static/src/js/im_livechat.js
+++ b/addons/im_livechat/static/src/js/im_livechat.js
@@ -267,6 +267,7 @@
return openerp.session.rpc("/rating/livechat/feedback", {uuid: uuid, rate: this.rating, reason : this.reason}).then(function(res) {
if(close){
self.trigger("feedback_sent"); // will close the conversation
+ self.conversation.send_message(_.str.sprintf(_t("I rated you with :rating_%d"), self.rating), "message");
}
});
}
diff --git a/addons/rating/views/rating_view.xml b/addons/rating/views/rating_view.xml
index 417b34ed452..ec5ae2f143e 100644
--- a/addons/rating/views/rating_view.xml
+++ b/addons/rating/views/rating_view.xml
@@ -7,14 +7,13 @@
<field name="arch" type="xml">
<kanban create="false" class="oe_background_grey">
<field name="rating"/>
+ <field name="res_id"/>
+ <field name="res_model"/>
<field name="res_name"/>
<field name="create_date"/>
<field name="partner_id"/>
<field name="rated_partner_id"/>
<field name="feedback"/>
- <!-- those 2 are required to redirect to the view form object, in JS -->
- <field name="res_id"/>
- <field name="res_model"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_card oe_kanban_global_click">