Added two mail.message.subtypes to notify all followers of updates to patient status and changes to injury fields. Added a post-migration script to update all existing followers to subscribe to these new subtypes.
21 lines
841 B
Python
21 lines
841 B
Python
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)]
|
|
})
|