Fix for teams not showing up on res_user form.

This commit is contained in:
Marc Durepos 2023-11-07 11:37:34 -05:00
parent d6c40a456e
commit 9bd47d8180
3 changed files with 13 additions and 3 deletions

View file

@ -18,7 +18,7 @@
#
{
'name': 'Sports Clinic Management',
'version': '16.0.1.3.0',
'version': '16.0.1.4.0',
'summary': 'Manage the patients of a sports medicine clinic.',
'description': """
Adds the notion of sports teams, players (patients), coaches and treatment

View file

@ -13,4 +13,9 @@ class Partner(models.Model):
inverse_name='partner_id',
string='Teams Served',
help='The teams this person works for.')
teams_served_ids = fields.One2many(comodel_name='sports.team', compute='_compute_teams_served')
@api.depends('team_staff_rel_ids.team_id')
def _compute_teams_served(self):
for rec in self:
rec.teams_served_ids = rec.team_staff_rel_ids.mapped('team_id')

View file

@ -6,8 +6,13 @@
<field name="model">res.partner</field>
<field name="arch" type="xml">
<page name="contact_addresses" position="after">
<page name="teams" attrs="{'invisible': [('owned_team_ids', '=', False)]}" string="Teams">
<field name="owned_team_ids"/>
<page name="Teams">
<field name="owned_team_ids"
attrs="{'invisible': [('is_company', '=', False)]}"
string="Teams"/>
<field name="teams_served_ids"
attrs="{'invisible': [('is_company', '=', True)]}"
string="Teams Served"/>
</page>
</page>
</field>