diff options
| author | David Beguin <dbe@odoo.com> | 2018-10-22 15:28:36 +0000 |
|---|---|---|
| committer | David Beguin <dbe@odoo.com> | 2018-12-05 14:37:13 +0000 |
| commit | 2986a5a412fcfcaf97a38f087bfa492a9f87d073 (patch) | |
| tree | d5ec92f17ca1372dc25fc9bd63121987acc2d806 /addons/im_livechat/controllers | |
| parent | 8c8f219b4764173fb1ac924d8a46d9dcdbb85d57 (diff) | |
[IMP] im_livechat : add measures to channel report to be used in Dashboard
Adds some indicators in channel report in order to use them in the new
enterprise livechat dashboard. Those indicator are added here to re-use
directly the channel report view. It allows the users to use also those
new indicators in the existing reports.
- No answer indicator
- Days of activity indicator
- Day number indicator
- Country of visitor :
This makes able to see from which country comes the visitors
and make statistics with it.
If no GeoIP server are installed, or if the country is not found,
or if visitor is logged in but has no country configured, the country
si set to 'Unknown'.
Also, align sessions and operator report title on menu name
Task ID : 1895998
Closes PR #28283
Diffstat (limited to 'addons/im_livechat/controllers')
| -rw-r--r-- | addons/im_livechat/controllers/main.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/addons/im_livechat/controllers/main.py b/addons/im_livechat/controllers/main.py index 904aba2689b..abe0e17bb0c 100644 --- a/addons/im_livechat/controllers/main.py +++ b/addons/im_livechat/controllers/main.py @@ -70,14 +70,19 @@ class LivechatController(http.Controller): @http.route('/im_livechat/get_session', type="json", auth='public') def get_session(self, channel_id, anonymous_name, **kwargs): user_id = None + country_id = None # if the user is identifiy (eg: portal user on the frontend), don't use the anonymous name. The user will be added to session. if request.session.uid: user_id = request.env.user.id + country_id = request.env.user.country_id.id # if geoip, add the country name to the anonymous name elif request.session.geoip: - anonymous_name = anonymous_name + " ("+request.session.geoip.get('country_name', "")+")" - return request.env["im_livechat.channel"].with_context(lang=False).get_mail_channel(channel_id, anonymous_name, user_id) - + # get the country of the anonymous person, if any + country_code = request.session.geoip.get('country_code', "") + country = request.env['res.country'].sudo().search([('code', '=', country_code)], limit=1) if country_code else None + if country: + anonymous_name, country_id = _("%s (%s)") % (anonymous_name, country.name), country.id + return request.env["im_livechat.channel"].with_context(lang=False).get_mail_channel(channel_id, anonymous_name, user_id, country_id) @http.route('/im_livechat/feedback', type='json', auth='public') def feedback(self, uuid, rate, reason=None, **kwargs): |
