Migrated bemade_sports_clinic to 18.0
This commit is contained in:
parent
7ca1c1ee02
commit
b4eea01a20
14 changed files with 23 additions and 112 deletions
|
|
@ -18,7 +18,7 @@
|
|||
#
|
||||
{
|
||||
'name': 'Sports Clinic Management',
|
||||
'version': '17.0.1.6.2',
|
||||
'version': '18.0.1.6.2',
|
||||
'summary': 'Manage the patients of a sports medicine clinic.',
|
||||
'description': """
|
||||
Adds the notion of sports teams, players (patients), coaches and treatment
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
"category": "Services/Medical",
|
||||
"author": "Bemade Inc.",
|
||||
"website": "https://www.bemade.org",
|
||||
"license": "OPL-1",
|
||||
"license": "LGPL-3",
|
||||
"depends": ["portal", "contacts"],
|
||||
"external_dependencies": {
|
||||
"python": [
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
from odoo import api, SUPERUSER_ID, Command
|
||||
|
||||
def migrate(cr, version):
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
patient_followers = env['mail.followers'].search([('res_model', '=',
|
||||
'sports.patient')])
|
||||
injury_followers = env['mail.followers'].search([('res_model', '=',
|
||||
'sports.patient.injury')])
|
||||
for f in patient_followers:
|
||||
f.write(
|
||||
{
|
||||
'subtype_ids':
|
||||
[Command.link(env.ref('bemade_sports_clinic.subtype_patient_update').id)]
|
||||
}
|
||||
)
|
||||
for f in injury_followers:
|
||||
f.write(
|
||||
{
|
||||
'subtype_ids':
|
||||
[Command.link(env.ref('bemade_sports_clinic.subtype_patient_injury_update').id)]
|
||||
})
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
from odoo import api, SUPERUSER_ID, Command
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
|
||||
patient_followers = env['mail.followers'].search([('res_model', '=',
|
||||
'sports.patient')])
|
||||
injury_followers = env['mail.followers'].search([('res_model', '=',
|
||||
'sports.patient.injury')])
|
||||
for f in patient_followers:
|
||||
if f.partner_id.user_ids.has_group('base.group_user'):
|
||||
subtype = env.ref('bemade_sports_clinic.subtype_patient_internal_update').id
|
||||
else:
|
||||
subtype = env.ref('bemade_sports_clinic.subtype_patient_external_update').id
|
||||
f.write({'subtype_ids': [Command.link(subtype)]})
|
||||
for f in injury_followers:
|
||||
if f.partner_id.user_ids.has_group('base.group_user'):
|
||||
subtype = env.ref('bemade_sports_clinic.subtype_patient_injury_internal_update').id
|
||||
else:
|
||||
subtype = env.ref('bemade_sports_clinic.subtype_patient_injury_external_update').id
|
||||
f.write({'subtype_ids': [Command.link(subtype)]})
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
from odoo import api, SUPERUSER_ID
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
env["sports.team"].search([])._allow_access_for_staff_internal_users()
|
||||
cr.execute('CREATE EXTENSION IF NOT EXISTS "unaccent"')
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
from odoo import api, SUPERUSER_ID
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
env["sports.patient"].search([]).recompute_followers()
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
""" Patient access revised to make the team staff relationship central to
|
||||
access. Everything is calculated from there. Inverse functions deal with
|
||||
sports.team.staff records instead of having a separate table for storing
|
||||
access rights."""
|
||||
|
||||
from odoo import api, SUPERUSER_ID, Command
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
rules = (
|
||||
env.ref("bemade_sports_clinic.restrict_staff_access_to_teams")
|
||||
+ env.ref("bemade_sports_clinic.restrict_staff_access_to_team_injuries")
|
||||
+ env.ref("bemade_sports_clinic.restrict_staff_access_to_team_players")
|
||||
)
|
||||
rules.write({
|
||||
"groups": [Command.link(env.ref("base.group_user").id)]
|
||||
})
|
||||
env.ref("bemade_sports_clinic.group_sports_clinic_user").write({
|
||||
"implied_ids": [Command.link(env.ref("base.group_partner_manager").id)]
|
||||
})
|
||||
cr.execute("DROP TABLE sports_team_res_users_rel")
|
||||
# Check the groups are OK
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
import openupgradelib.openupgrade as ou
|
||||
from odoo import SUPERUSER_ID, api
|
||||
|
||||
def migrate(cr, version):
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
ou.delete_records_safely_by_xml_id(env, [
|
||||
"bemade_sports_clinic.restrict_team_access_to_allowed_internal_users",
|
||||
"bemade_sports_clinic.restrict_patient_access_to_allowed_internal_users",
|
||||
"bemade_sports_clinic.restrict_injury_access_to_allowed_internal_users",
|
||||
])
|
||||
|
|
@ -290,7 +290,7 @@ class Patient(models.Model):
|
|||
"bemade_sports_clinic.mail_template_patient_status_update"
|
||||
),
|
||||
{
|
||||
"auto_delete_message": False,
|
||||
"auto_delete": False,
|
||||
"subtype_id": self.env.ref(
|
||||
"bemade_sports_clinic.subtype_patient_external_update"
|
||||
).id,
|
||||
|
|
@ -303,7 +303,7 @@ class Patient(models.Model):
|
|||
"bemade_sports_clinic.mail_template_patient_new_internal_note"
|
||||
),
|
||||
{
|
||||
"auto_delete_message": False,
|
||||
"auto_delete": False,
|
||||
"subtype_id": self.env.ref(
|
||||
"bemade_sports_clinic.subtype_patient_internal_update"
|
||||
).id,
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ class PatientInjury(models.Model):
|
|||
"bemade_sports_clinic.mail_template_patient_injury_status_update"
|
||||
),
|
||||
{
|
||||
"auto_delete_message": False,
|
||||
"auto_delete": False,
|
||||
"subtype_id": self.env.ref(
|
||||
"bemade_sports_clinic.subtype_patient_injury_external_update"
|
||||
).id,
|
||||
|
|
@ -159,7 +159,7 @@ class PatientInjury(models.Model):
|
|||
"bemade_sports_clinic.mail_template_patient_injury_new_internal_note"
|
||||
),
|
||||
{
|
||||
"auto_delete_message": False,
|
||||
"auto_delete": False,
|
||||
"subtype_id": self.env.ref(
|
||||
"bemade_sports_clinic.subtype_patient_injury_internal_update"
|
||||
).id,
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@
|
|||
<page name="Teams">
|
||||
<field invisible="is_company == False" name="owned_team_ids" string="Teams"/>
|
||||
<field invisible="is_company == True" name="teams_served_ids" string="Teams Served">
|
||||
<tree editable="bottom" create="False" delete="True">
|
||||
<list editable="bottom" create="False" delete="True">
|
||||
<field name="name"/>
|
||||
<field name="parent_id"/>
|
||||
<field name="head_coach_id"/>
|
||||
<field name="head_therapist_id"/>
|
||||
<field name="player_count"/>
|
||||
<field name="injured_count"/>
|
||||
</tree>
|
||||
</list>
|
||||
</field>
|
||||
</page>
|
||||
</page></field>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<record id="action_view_team" model="ir.actions.act_window">
|
||||
<field name="name">Sports Teams</field>
|
||||
<field name="res_model">sports.team</field>
|
||||
<field name="view_mode">kanban,tree,form</field>
|
||||
<field name="view_mode">kanban,list,form</field>
|
||||
<field name="search_view_id" ref="teams_view_search"/>
|
||||
</record>
|
||||
<record id="action_view_team_kanban" model="ir.actions.act_window.view">
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
</record>
|
||||
<record id="action_view_team_list" model="ir.actions.act_window.view">
|
||||
<field name="sequence" eval="2"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_mode">list</field>
|
||||
<field name="act_window_id" ref="action_view_team"/>
|
||||
<field name="view_id" ref="sports_team_view_list"/>
|
||||
</record>
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
<record id="action_view_patient" model="ir.actions.act_window">
|
||||
<field name="name">Patients</field>
|
||||
<field name="res_model">sports.patient</field>
|
||||
<field name="view_mode">tree,kanban,form</field>
|
||||
<field name="view_mode">list,kanban,form</field>
|
||||
</record>
|
||||
<menuitem id="sports_clinic_root"
|
||||
web_icon="bemade_sports_clinic,static/description/icon.png"
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
<field name="name">sports.patient.injury.view.tree</field>
|
||||
<field name="model">sports.patient.injury</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Patient Injury History" editable="bottom"
|
||||
<list string="Patient Injury History" editable="bottom"
|
||||
multi_edit="True">
|
||||
<field name="patient_id" invisible="1"/>
|
||||
<field name="injury_date" widget="date"/>
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
<button name="action_view_injury_form" type="object"
|
||||
title="Details" string="Details"
|
||||
context="{'default_patient_id': patient_id}"/>
|
||||
</tree>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
<field name="name">sports.patient.view.list</field>
|
||||
<field name="model">sports.patient</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Patients"
|
||||
<list string="Patients"
|
||||
decoration-danger="stage == 'no_play'"
|
||||
decoration-warning="stage == 'practice_ok'">
|
||||
<field name="first_name"/>
|
||||
|
|
@ -36,14 +36,14 @@
|
|||
<field name="predicted_return_date" widget="date"/>
|
||||
<field name="return_date" widget="date"/>
|
||||
<field name="activity_ids" widget="list_activity"/>
|
||||
</tree>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
<record id="sports_patient_view_list_embedded" model="ir.ui.view">
|
||||
<field name="name">sports.patient.view.list.embedded</field>
|
||||
<field name="model">sports.patient</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Patients" multi_edit="True" editable="bottom"
|
||||
<list string="Patients" multi_edit="True" editable="bottom"
|
||||
decoration-danger="stage == 'no_play'"
|
||||
decoration-warning="stage == 'practice_ok'">
|
||||
<field name="first_name"/>
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
<field name="activity_ids" widget="list_activity"/>
|
||||
<button name="action_view_patient_form" type="object"
|
||||
title="Details" string="Details"/>
|
||||
</tree>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
<record id="sports_patient_view_kanban" model="ir.ui.view">
|
||||
|
|
@ -163,13 +163,13 @@
|
|||
</group>
|
||||
<group string="Other Contacts">
|
||||
<field name="contact_ids">
|
||||
<tree string="Patient's Contacts"
|
||||
<list string="Patient's Contacts"
|
||||
multi_edit="1" editable="bottom">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="name"/>
|
||||
<field name="contact_type"/>
|
||||
<field name="mobile" widget="phone"/>
|
||||
</tree>
|
||||
</list>
|
||||
</field>
|
||||
</group>
|
||||
</page>
|
||||
|
|
|
|||
|
|
@ -75,14 +75,14 @@
|
|||
<field name="name">sports.team.view.list</field>
|
||||
<field name="model">sports.team</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Sports Teams">
|
||||
<list string="Sports Teams">
|
||||
<field name="name"/>
|
||||
<field name="parent_id"/>
|
||||
<field name="head_coach_id"/>
|
||||
<field name="head_therapist_id"/>
|
||||
<field name="player_count"/>
|
||||
<field name="injured_count"/>
|
||||
</tree></field>
|
||||
</list></field>
|
||||
</record>
|
||||
<record id="sports_team_view_form" model="ir.ui.view">
|
||||
<field name="name">sports.team.view.form</field>
|
||||
|
|
@ -105,7 +105,7 @@
|
|||
<field name="injured_count"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="staff_ids"><tree>
|
||||
<field name="staff_ids"><list>
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="name"/>
|
||||
<field name="role"/>
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
<field invisible="1" name="partner_id"/>
|
||||
<button class="oe_highlight" groups="bemade_sports_clinic.group_sports_clinic_admin,base.group_system" icon="fa-user-plus" invisible="has_portal_access == True" name="action_grant_portal_access" title="Grant Portal Access" type="object"/>
|
||||
<button class="oe_highlight" groups="bemade_sports_clinic.group_sports_clinic_admin,base.group_system" icon="fa-ban" invisible="has_portal_access == False" name="action_revoke_portal_access" title="Revoke Portal Access" type="object"/>
|
||||
</tree></field>
|
||||
</list></field>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
|
|
|
|||
Loading…
Reference in a new issue