More changes for iteration 4:
- Change phone to mobile for team staff - Add Doctor to roles selection for team staff - Replace "Trainer" by "Therapist" everywhere
This commit is contained in:
parent
9ac9aad551
commit
7cd32e2b93
6 changed files with 60 additions and 55 deletions
|
|
@ -16,7 +16,7 @@
|
|||
<field name="state_id" ref="base.state_ca_qc"/>
|
||||
<field name="country_id" ref="base.ca"/>
|
||||
<field name="zip">H3C 3J7</field>
|
||||
<field name="phone">+1 (514) 343-6111</field>
|
||||
<field name="mobile">+1 (514) 343-6111</field>
|
||||
<field name="website">https://www.umontreal.ca</field>
|
||||
<field name="is_company" eval="True"/>
|
||||
</record>
|
||||
|
|
@ -35,15 +35,15 @@
|
|||
<field name="team_id" ref="team_carabins"/>
|
||||
<field name="role">head_coach</field>
|
||||
</record>
|
||||
<record id="partner_trainer_team_carabins" model="res.partner">
|
||||
<record id="partner_therapist_team_carabins" model="res.partner">
|
||||
<field name="name">Stretch Carabinier</field>
|
||||
<field name="email">streth.carabinier@carabins.umontreal.ca</field>
|
||||
<field name="parent_id" ref="partner_org_1"/>
|
||||
</record>
|
||||
<record id="carabins_trainer_rel" model="sports.team.staff">
|
||||
<field name="partner_id" ref="partner_trainer_team_carabins"/>
|
||||
<record id="carabins_therapist_rel" model="sports.team.staff">
|
||||
<field name="partner_id" ref="partner_therapist_team_carabins"/>
|
||||
<field name="team_id" ref="team_carabins"/>
|
||||
<field name="role">head_trainer</field>
|
||||
<field name="role">head_therapist</field>
|
||||
</record>
|
||||
<record id="patient_1" model="sports.patient">
|
||||
<field name="first_name">Jean</field>
|
||||
|
|
@ -73,10 +73,10 @@
|
|||
<field name="team_id" ref="team_carabins_hockey"/>
|
||||
<field name="role">head_coach</field>
|
||||
</record>
|
||||
<record id="carabins_hockey_trainer_rel" model="sports.team.staff">
|
||||
<field name="partner_id" ref="partner_trainer_team_carabins"/>
|
||||
<record id="carabins_hockey_therapist_rel" model="sports.team.staff">
|
||||
<field name="partner_id" ref="partner_therapist_team_carabins"/>
|
||||
<field name="team_id" ref="team_carabins_hockey"/>
|
||||
<field name="role">head_trainer</field>
|
||||
<field name="role">head_therapist</field>
|
||||
</record>
|
||||
<record id="patient_3" model="sports.patient">
|
||||
<field name="first_name">Jeanne</field>
|
||||
|
|
@ -161,10 +161,10 @@
|
|||
<record id="base.partner_demo_portal" model="res.partner">
|
||||
<field name="parent_id" ref="partner_org_2"/>
|
||||
</record>
|
||||
<record id="carabins_trainer_user" model="res.users" context="{'no_reset_password': True}">
|
||||
<field name="partner_id" ref="partner_trainer_team_carabins"/>
|
||||
<field name="login">trainer</field>
|
||||
<field name="password">trainer</field>
|
||||
<record id="carabins_therapist_user" model="res.users" context="{'no_reset_password': True}">
|
||||
<field name="partner_id" ref="partner_therapist_team_carabins"/>
|
||||
<field name="login">therapist</field>
|
||||
<field name="password">therapist</field>
|
||||
<field name="groups_id" eval="[Command.clear()]"/>
|
||||
</record>
|
||||
<record id="carabins_coach_user" model="res.users" context="{'no_reset_password': True}">
|
||||
|
|
@ -174,7 +174,7 @@
|
|||
<field name="groups_id" eval="[Command.clear()]"/>
|
||||
</record>
|
||||
<record id="base.group_portal" model="res.groups">
|
||||
<field name="users" eval="[Command.link(ref('carabins_trainer_user'))]"/>
|
||||
<field name="users" eval="[Command.link(ref('carabins_therapist_user'))]"/>
|
||||
</record>
|
||||
<record id="base.group_portal" model="res.groups">
|
||||
<field name="users" eval="[Command.link(ref('carabins_coach_user'))]"/>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ msgstr "Une équipe ne peut avoir qu'un seul entraineur chef."
|
|||
#. odoo-python
|
||||
#: code:addons/bemade_sports_clinic/models/sports_team.py:0
|
||||
#, python-format
|
||||
msgid "A team can have only one head trainer."
|
||||
msgid "A team can have only one head therapist."
|
||||
msgstr "Une équipe ne peut avoir qu'un seul thérapeute en chef."
|
||||
|
||||
#. module: bemade_sports_clinic
|
||||
|
|
@ -269,9 +269,9 @@ msgid "Head Coach"
|
|||
msgstr "Entraîneur chef"
|
||||
|
||||
#. module: bemade_sports_clinic
|
||||
#: model:ir.model.fields,field_description:bemade_sports_clinic.field_sports_team__head_trainer_id
|
||||
#: model:ir.model.fields.selection,name:bemade_sports_clinic.selection__sports_team_staff__role__head_trainer
|
||||
msgid "Head Trainer"
|
||||
#: model:ir.model.fields,field_description:bemade_sports_clinic.field_sports_team__head_therapist_id
|
||||
#: model:ir.model.fields.selection,name:bemade_sports_clinic.selection__sports_team_staff__role__head_therapist
|
||||
msgid "Head Therapist"
|
||||
msgstr "Thérapeute en chef"
|
||||
|
||||
#. module: bemade_sports_clinic
|
||||
|
|
@ -281,7 +281,7 @@ msgstr "Entraîneur chef :"
|
|||
|
||||
#. module: bemade_sports_clinic
|
||||
#: model_terms:ir.ui.view,arch_db:bemade_sports_clinic.sports_team_view_kanban
|
||||
msgid "Head trainer:"
|
||||
msgid "Head therapist:"
|
||||
msgstr "Thérapeute en chef :"
|
||||
|
||||
#. module: bemade_sports_clinic
|
||||
|
|
@ -481,7 +481,7 @@ msgstr "Date limite de mon activité"
|
|||
#: model:ir.model.fields,field_description:bemade_sports_clinic.field_sports_patient_contact__name
|
||||
#: model:ir.model.fields,field_description:bemade_sports_clinic.field_sports_patient_injury__patient_name
|
||||
#: model:ir.model.fields,field_description:bemade_sports_clinic.field_sports_team__head_coach_name
|
||||
#: model:ir.model.fields,field_description:bemade_sports_clinic.field_sports_team__head_trainer_name
|
||||
#: model:ir.model.fields,field_description:bemade_sports_clinic.field_sports_team__head_therapist_name
|
||||
#: model:ir.model.fields,field_description:bemade_sports_clinic.field_sports_team__name
|
||||
#: model:ir.model.fields,field_description:bemade_sports_clinic.field_sports_team_staff__name
|
||||
msgid "Name"
|
||||
|
|
@ -615,11 +615,11 @@ msgid "Patients"
|
|||
msgstr "Patients"
|
||||
|
||||
#. module: bemade_sports_clinic
|
||||
#: model:ir.model.fields,field_description:bemade_sports_clinic.field_sports_patient__phone
|
||||
#: model:ir.model.fields,field_description:bemade_sports_clinic.field_sports_patient_contact__phone
|
||||
#: model:ir.model.fields,field_description:bemade_sports_clinic.field_sports_team_staff__phone
|
||||
msgid "Phone"
|
||||
msgstr "Téléphone"
|
||||
#: model:ir.model.fields,field_description:bemade_sports_clinic.field_sports_patient__mobile
|
||||
#: model:ir.model.fields,field_description:bemade_sports_clinic.field_sports_patient_contact__mobile
|
||||
#: model:ir.model.fields,field_description:bemade_sports_clinic.field_sports_team_staff__mobile
|
||||
msgid "Mobile"
|
||||
msgstr "Mobile"
|
||||
|
||||
#. module: bemade_sports_clinic
|
||||
#: model:ir.model.fields,field_description:bemade_sports_clinic.field_sports_team__player_count
|
||||
|
|
@ -824,10 +824,15 @@ msgid "Total Players"
|
|||
msgstr "Total des joueurs"
|
||||
|
||||
#. module: bemade_sports_clinic
|
||||
#: model:ir.model.fields.selection,name:bemade_sports_clinic.selection__sports_team_staff__role__trainer
|
||||
msgid "Trainer"
|
||||
#: model:ir.model.fields.selection,name:bemade_sports_clinic.selection__sports_team_staff__role__therapist
|
||||
msgid "Therapist"
|
||||
msgstr "Thérapeute"
|
||||
|
||||
#. module: bemade_sports_clinic
|
||||
#: model:ir.model.fields.selection,name:bemade_sports_clinic.selection__sports_team_staff__role__doctor
|
||||
msgid "Doctor"
|
||||
msgstr "Docteur"
|
||||
|
||||
#. module: bemade_sports_clinic
|
||||
#: model:res.groups,name:bemade_sports_clinic.group_sports_clinic_treatment_professional
|
||||
msgid "Treatment Professional"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class Patient(models.Model):
|
|||
age = fields.Integer(compute='_compute_age',
|
||||
groups="bemade_sports_clinic.group_sports_clinic_treatment_professional",
|
||||
tracking=True)
|
||||
phone = fields.Char(unaccent=False,
|
||||
mobile = fields.Char(unaccent=False,
|
||||
groups="bemade_sports_clinic.group_sports_clinic_user",
|
||||
tracking=True)
|
||||
email = fields.Char(groups="bemade_sports_clinic.group_sports_clinic_user",
|
||||
|
|
@ -154,7 +154,7 @@ class PatientContact(models.Model):
|
|||
('father', 'Father'),
|
||||
('other', 'Other'),
|
||||
], required=True)
|
||||
phone = fields.Char(unaccent=False, required=True)
|
||||
mobile = fields.Char(unaccent=False, required=True)
|
||||
patient_id = fields.Many2one(comodel_name='sports.patient', string='Patient')
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ class SportsTeam(models.Model):
|
|||
compute='_compute_head_coach',
|
||||
store=True)
|
||||
head_coach_name = fields.Char(related='head_coach_id.name')
|
||||
head_trainer_id = fields.Many2one(comodel_name='res.partner',
|
||||
compute='_compute_head_trainer',
|
||||
head_therapist_id = fields.Many2one(comodel_name='res.partner',
|
||||
compute='_compute_head_therapist',
|
||||
store=True)
|
||||
head_trainer_name = fields.Char(related='head_trainer_id.name')
|
||||
head_therapist_name = fields.Char(related='head_therapist_id.name')
|
||||
website = fields.Char()
|
||||
|
||||
@api.depends('patient_ids.is_injured')
|
||||
|
|
@ -43,10 +43,10 @@ class SportsTeam(models.Model):
|
|||
rec.head_coach_id = staff.partner_id if staff else False
|
||||
|
||||
@api.depends('staff_ids.role')
|
||||
def _compute_head_trainer(self):
|
||||
def _compute_head_therapist(self):
|
||||
for rec in self:
|
||||
staff = rec.staff_ids.filtered(lambda r: r.role == 'head_trainer')
|
||||
rec.head_trainer_id = staff.partner_id if staff else False
|
||||
staff = rec.staff_ids.filtered(lambda r: r.role == 'head_therapist')
|
||||
rec.head_therapist_id = staff.partner_id if staff else False
|
||||
|
||||
|
||||
class TeamStaff(models.Model):
|
||||
|
|
@ -59,12 +59,13 @@ class TeamStaff(models.Model):
|
|||
required=True, domain=[('is_company', '=', False)])
|
||||
role = fields.Selection(selection=[
|
||||
('head_coach', 'Head Coach'),
|
||||
('head_trainer', 'Head Trainer'),
|
||||
('head_therapist', 'Head Therapist'),
|
||||
('coach', 'Coach'),
|
||||
('trainer', 'Trainer'),
|
||||
('therapist', 'Therapist'),
|
||||
('doctor', 'Doctor'),
|
||||
('other', 'Other')
|
||||
], required=True)
|
||||
phone = fields.Char(related='partner_id.phone', readonly=False)
|
||||
mobile = fields.Char(related='partner_id.mobile', readonly=False)
|
||||
name = fields.Char(related='partner_id.name', readonly=False)
|
||||
parent_id = fields.Many2one(related='partner_id.parent_id', readonly=False, string="Organization",
|
||||
domain=[('is_company', '=', True)])
|
||||
|
|
@ -74,20 +75,19 @@ class TeamStaff(models.Model):
|
|||
|
||||
_sql_constraints = [('team_staff_unique', 'unique(team_id, partner_id)',
|
||||
'Each partner can only be related to a given team once.')]
|
||||
|
||||
@api.constrains('role')
|
||||
def _constrain_role(self):
|
||||
teams = self.mapped('team_id')
|
||||
for team in teams:
|
||||
if len(team.staff_ids.filtered(lambda r: r.role == 'head_coach')) > 1:
|
||||
raise ValidationError(_("A team can have only one head coach."))
|
||||
if len(team.staff_ids.filtered(lambda r: r.role == 'head_trainer')) > 1:
|
||||
raise ValidationError(_("A team can have only one head trainer."))
|
||||
if len(team.staff_ids.filtered(lambda r: r.role == 'head_therapist')) > 1:
|
||||
raise ValidationError(_("A team can have only one head therapist."))
|
||||
|
||||
@api.onchange('phone')
|
||||
def _onchange_phone_validation(self):
|
||||
if self.phone:
|
||||
self.phone = self.partner_id._phone_format(self.phone, force_format='INTERNATIONAL')
|
||||
@api.onchange('mobile')
|
||||
def _onchange_mobile_validation(self):
|
||||
if self.mobile:
|
||||
self.mobile = self.partner_id._phone_format(self.mobile, force_format='INTERNATIONAL')
|
||||
|
||||
@api.depends('user_ids', 'user_ids.groups_id')
|
||||
def _compute_has_portal_access(self):
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<field name="team_ids"/>
|
||||
<field name="date_of_birth" widget="date"/>
|
||||
<field name="email" widget="email"/>
|
||||
<field name="phone" widget="phone"/>
|
||||
<field name="mobile" widget="phone"/>
|
||||
<field name="predicted_return_date"/>
|
||||
<field name="return_date"/>
|
||||
<filter name="groupby_team_ids" context="{'group_by': 'team_ids'}"/>
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
<field name="sequence" widget="handle"/>
|
||||
<field name="name"/>
|
||||
<field name="contact_type"/>
|
||||
<field name="phone" widget="phone"/>
|
||||
<field name="mobile" widget="phone"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@
|
|||
<field name="name"/>
|
||||
<field name="parent_id" string="Parent Organization"/>
|
||||
<field name="head_coach_id"/>
|
||||
<field name="head_trainer_id"/>
|
||||
<field name="head_therapist_id"/>
|
||||
<filter name="groupby_parent_id"
|
||||
context="{'group_by': 'parent_id'}"/>
|
||||
<filter name="groupby_head_coach_id"
|
||||
context="{'group_by': 'head_coach_id'}"/>
|
||||
<filter name="groupby_head_trainer_id"
|
||||
context="{'group_by': 'head_trainer_id'}"/>
|
||||
<filter name="groupby_head_therapist_id"
|
||||
context="{'group_by': 'head_therapist_id'}"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
<field name="name"/>
|
||||
<field name="parent_id"/>
|
||||
<field name="head_coach_name"/>
|
||||
<field name="head_trainer_name"/>
|
||||
<field name="head_therapist_name"/>
|
||||
<field name="injured_count"/>
|
||||
<field name="healthy_count"/>
|
||||
<templates>
|
||||
|
|
@ -48,8 +48,8 @@
|
|||
name="head_coach_name"/></span>
|
||||
</div>
|
||||
<div>
|
||||
<span>Head trainer: <field
|
||||
name="head_trainer_name"/></span>
|
||||
<span>Head therapist: <field
|
||||
name="head_therapist_name"/></span>
|
||||
</div>
|
||||
<div class="o_kanban_record_bottom">
|
||||
<div class="oe_kanban_bottom_left">
|
||||
|
|
@ -78,7 +78,7 @@
|
|||
<field name="name"/>
|
||||
<field name="parent_id"/>
|
||||
<field name="head_coach_id"/>
|
||||
<field name="head_trainer_id"/>
|
||||
<field name="head_therapist_id"/>
|
||||
<field name="player_count"/>
|
||||
<field name="injured_count"/>
|
||||
</tree>
|
||||
|
|
@ -106,7 +106,7 @@
|
|||
<field name="sequence" widget="handle"/>
|
||||
<field name="name"/>
|
||||
<field name="role"/>
|
||||
<field name="phone" widget="phone"/>
|
||||
<field name="mobile" widget="phone"/>
|
||||
<field name="has_portal_access" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
<button name="action_grant_portal_access"
|
||||
|
|
@ -145,7 +145,7 @@
|
|||
<field name="role"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="phone" widget="phone"/>
|
||||
<field name="mobile" widget="phone"/>
|
||||
<field name="email" widget="email"/>
|
||||
</group>
|
||||
</group>
|
||||
|
|
|
|||
Loading…
Reference in a new issue