[FIX] calendar: compare display_name for empty recordset
When sorting by a many2many fields (e.g. partner_ids) with one of the record having an empty value on the sorted field, the comparison method used to compare and empty record (e.g. res.partner()) and a name_get result (e.g. "Agrolait"). This is because the sort_field was initialized with the result of self[field] but never assigned a new value below. Fallback on an empty string when no record is found Fixes #26908
This commit is contained in:
@@ -997,9 +997,8 @@ class Meeting(models.Model):
|
||||
else:
|
||||
sort_fields[field] = self[field]
|
||||
if isinstance(self[field], models.BaseModel):
|
||||
name_get = self[field].name_get()
|
||||
if len(name_get) and len(name_get[0]) >= 2:
|
||||
sort_fields[field] = name_get[0][1]
|
||||
name_get = self[field].mapped('display_name')
|
||||
sort_fields[field] = name_get and name_get[0] or ''
|
||||
if r_date:
|
||||
sort_fields['sort_start'] = r_date.strftime(VIRTUALID_DATETIME_FORMAT)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user