summaryrefslogtreecommitdiff
path: root/addons/website_crm_livechat
diff options
context:
space:
mode:
authorThibault Francois <tfr@openerp.com>2020-10-08 14:45:35 +0000
committerThibault Francois <tfr@openerp.com>2020-10-09 07:55:15 +0000
commitea70c7b55387df382273b2519c4e75ee207f19ba (patch)
tree18a1e9ce3d4ca97c1e50aa8d3eb59993f489dc59 /addons/website_crm_livechat
parent524b9acb4582321d4d9ee8d21b700a10837cf836 (diff)
[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#59571 X-original-commit: eff2b357db179e6e62f3db58ca2d90cc61c3748f Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/website_crm_livechat')
-rw-r--r--addons/website_crm_livechat/models/mail_channel.py1
1 files changed, 1 insertions, 0 deletions
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