diff options
| author | Jeremy Kersten <jke@odoo.com> | 2019-10-07 08:56:02 +0000 |
|---|---|---|
| committer | fw-bot <otis@odoo.com> | 2019-10-17 15:35:11 +0000 |
| commit | 3a7033463ea98def2e3fb85333c4f00f7c7d6925 (patch) | |
| tree | 87f8f5c707c4925b30d77d4fa9c2ce7eeaf2cd61 /addons/website_livechat | |
| parent | 734f0af61f4cc642f30083eb013c56bba1f82d83 (diff) | |
[FIX] website: allow authenticate in json multidb
Before this commit launch a server with --db-filter that match at least 2 dbs name
Try to authenticate
You will have an error request is unbound when you try to access request.env
Now we retrieve the user from self instead of the request.
New test to ensure rpc authentication is tested.
Related to commit 245ef4b1
closes odoo/odoo#38969
X-original-commit: 4b3400c430bec7539aada0619fd203978daca2d8
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/website_livechat')
| -rw-r--r-- | addons/website_livechat/models/website_visitor.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/website_livechat/models/website_visitor.py b/addons/website_livechat/models/website_visitor.py index 84d52f54d47..059a1ca61da 100644 --- a/addons/website_livechat/models/website_visitor.py +++ b/addons/website_livechat/models/website_visitor.py @@ -84,7 +84,7 @@ class WebsiteVisitor(models.Model): This will only happen if the mail channel linked to the chat request already has a message. So that empty livechat channel won't pop up at client side. """ super(WebsiteVisitor, self)._handle_website_page_visit(response, website_page, visitor_sudo) - visitor_id = self.env['website.visitor']._get_visitor_from_request().id if not visitor_sudo else visitor_sudo.id + visitor_id = visitor_sudo.id or self.env['website.visitor']._get_visitor_from_request().id if visitor_id: # get active chat_request linked to visitor chat_request_channel = self.env['mail.channel'].sudo().search([('livechat_visitor_id', '=', visitor_id), ('livechat_active', '=', True)], order='create_date desc', limit=1) @@ -101,5 +101,5 @@ class WebsiteVisitor(models.Model): "uuid": chat_request_channel.uuid, "type": "chat_request" }) - expiration_date = datetime.now() + timedelta(days=100*365) # never expire + expiration_date = datetime.now() + timedelta(days=100 * 365) # never expire response.set_cookie('im_livechat_session', livechat_session, expires=expiration_date.timestamp()) |
