[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:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user