bemade-addons/bemade_sports_clinic/migrations/16.0.1.5.4/post-migrate.py
Marc Durepos bcbb3bda1f bemade_sports_clinic: notify team staff of updates
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.
2024-01-13 18:52:37 -05:00

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)]
})