[IMP] sales_team: display empty sales teams on members' kanban view
When we open the 'CRM > Configuration > Team Members' menu, if there are no members in any of the teams, we see the empty screen(no dummy data, no action helper), which looks a bit ugly. This commit improves the behavior by displaying all the (accessible) sales teams, even if they are empty. So, even if there are no members available, we will get to see the dummy data and action helper. Note that in the data, we already have one sales team available, so this should be okay. But if someone intentionally removes all the teams, it will still lead to an empty ugly screen. Since this is a rare case, we haven't considered it for now. task-2583755 Part-of: odoo/odoo#92616
This commit is contained in:
@@ -13,7 +13,7 @@ class CrmTeamMember(models.Model):
|
||||
_check_company_auto = True
|
||||
|
||||
crm_team_id = fields.Many2one(
|
||||
'crm.team', string='Sales Team',
|
||||
'crm.team', string='Sales Team', group_expand='_read_group_crm_team_id',
|
||||
default=False, # TDE: temporary fix to activate depending computed fields
|
||||
check_company=True, index=True, ondelete="cascade", required=True)
|
||||
user_id = fields.Many2one(
|
||||
@@ -179,6 +179,13 @@ class CrmTeamMember(models.Model):
|
||||
])
|
||||
return super(CrmTeamMember, self).write(values)
|
||||
|
||||
@api.model
|
||||
def _read_group_crm_team_id(self, teams, domain, order):
|
||||
"""Read group customization in order to display all the teams in
|
||||
Kanban view, even if they are empty.
|
||||
"""
|
||||
return self.env['crm.team'].search([], order=order)
|
||||
|
||||
def _synchronize_memberships(self, user_team_ids):
|
||||
""" Synchronize memberships: archive other memberships.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user