[FIX] crm: handle selection fields correctly while merging leads

When merging two or more leads, a traceback was generated when attempting
to merge some selection field, if any.

closes https://github.com/odoo/odoo/issues/25644

opw 1864870
This commit is contained in:
len-odoo
2018-07-10 15:05:56 +02:00
committed by len-odoo
parent cd5c10a47f
commit ddb68eb1bb
+2 -1
View File
@@ -504,7 +504,8 @@ class Lead(FormatAddress, models.Model):
for field in fields:
value = getattr(self, field.name, False)
if field.ttype == 'selection':
value = dict(field.get_values(self.env)).get(value, value)
selections = self.fields_get()[field.name]['selection']
value = next((v[1] for v in selections if v[0] == value), value)
elif field.ttype == 'many2one':
if value:
value = value.sudo().name_get()[0][1]