From 7f10e89d21ebe9146c9ab222f4e9db838cea69db Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Thu, 8 Oct 2020 14:45:35 +0000 Subject: [PATCH] [IMP] crm_livechat: add country from visitor to lead Issue ----- Automatic assignation assign leads mostly based on country. So far the country need to be set manually on the lead. Solution -------- Since we have the information on the website vistor works, set the country on the lead from the visitor website. Unless the visitor is link to a partner with a country. In that case setting a country will cancel the address sync from the partner to the lead. closes odoo/odoo#59575 X-original-commit: eff2b357db179e6e62f3db58ca2d90cc61c3748f Signed-off-by: Thibault Delavallee (tde) --- addons/website_crm_livechat/models/mail_channel.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/website_crm_livechat/models/mail_channel.py b/addons/website_crm_livechat/models/mail_channel.py index 8d0c2442cc6..64d5b93c1de 100644 --- a/addons/website_crm_livechat/models/mail_channel.py +++ b/addons/website_crm_livechat/models/mail_channel.py @@ -15,4 +15,5 @@ class MailChannel(models.Model): visitor_sudo = self.livechat_visitor_id.sudo() if visitor_sudo: visitor_sudo.write({'lead_ids': [(4, lead.id)]}) + lead.country_id = lead.country_id or visitor_sudo.country_id return lead