summaryrefslogtreecommitdiff
path: root/addons/im_livechat/controllers
diff options
context:
space:
mode:
authorDavid Beguin <dbe@odoo.com>2019-11-22 16:13:36 +0000
committerDavid Beguin <dbe@odoo.com>2019-11-22 16:32:19 +0000
commit1832d17d2146df474cd9cc2e1572fd185c6727d0 (patch)
tree2988e0758d612702f7109226f45753e04662c9c7 /addons/im_livechat/controllers
parent2106dd3cd10da44cd0b25897aaa5104f93aea703 (diff)
[FIX] im_livechat, website_livechat: fix use visitor name in livechat session
im_livechat main controller was referring to website.visitor but this module is not depending on website. The usage of website visitor's name should have been done in website_livechat module. This commit fix this issue. Task ID: 2116715 PR #40732 closes odoo/odoo#40884 X-original-commit: defb98c1083e55ff02f290c3c6257a4ca8dc7d1f Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/im_livechat/controllers')
-rw-r--r--addons/im_livechat/controllers/main.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/addons/im_livechat/controllers/main.py b/addons/im_livechat/controllers/main.py
index 22969a38c38..a4b5c7f8f9d 100644
--- a/addons/im_livechat/controllers/main.py
+++ b/addons/im_livechat/controllers/main.py
@@ -83,28 +83,24 @@ class LivechatController(http.Controller):
def get_session(self, channel_id, anonymous_name, previous_operator_id=None, **kwargs):
user_id = None
country_id = None
- visitor_name = anonymous_name
# 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
else:
- visitor_sudo = request.env['website.visitor']._get_visitor_from_request()
- if visitor_sudo:
- visitor_name = visitor_sudo.display_name
# if geoip, add the country name to the anonymous name
if request.session.geoip:
# 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:
- visitor_name = "%s (%s)" % (visitor_name, country.name)
+ anonymous_name = "%s (%s)" % (anonymous_name, country.name)
country_id = country.id
if previous_operator_id:
previous_operator_id = int(previous_operator_id)
- return request.env["im_livechat.channel"].with_context(lang=False).sudo().browse(channel_id)._open_livechat_mail_channel(visitor_name, previous_operator_id, user_id, country_id)
+ return request.env["im_livechat.channel"].with_context(lang=False).sudo().browse(channel_id)._open_livechat_mail_channel(anonymous_name, previous_operator_id, user_id, country_id)
@http.route('/im_livechat/feedback', type='json', auth='public', cors="*")
def feedback(self, uuid, rate, reason=None, **kwargs):