[FIX] website_crm_partner_assign: add tag if exists
Steps to reproduce the bug: - CRM--> Configuration --> Tags - Delete the tag "No more partner available" - CRM --> Lead --> Automatic Assignment Bug: It will raise Traceback `AttributeError: 'NoneType' object has no attribute 'id'` as Tag is not Present. With this Commit: It will add Tag if it exists on database. closes odoo/odoo#61470 X-original-commit: 631030ae179c65ae0d99603046b5a09ffe00c408 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
@@ -62,7 +62,8 @@ class CrmLead(models.Model):
|
||||
partner_id = partner_dict.get(lead.id, False)
|
||||
if not partner_id:
|
||||
tag_to_add = self.env.ref('website_crm_partner_assign.tag_portal_lead_partner_unavailable', False)
|
||||
lead.write({'tag_ids': [(4, tag_to_add.id, False)]})
|
||||
if tag_to_add:
|
||||
lead.write({'tag_ids': [(4, tag_to_add.id, False)]})
|
||||
continue
|
||||
lead.assign_geo_localize(lead.partner_latitude, lead.partner_longitude)
|
||||
partner = self.env['res.partner'].browse(partner_id)
|
||||
|
||||
Reference in New Issue
Block a user