docker-odoo/16.0/extra-addons/openems/migrations/16.0.1.0.1/post-migrate.py
Arila Barnes 5594ca8d5d Added support for OpenEMS Odoo Add-ons
Signed-off-by: Arila Barnes <axmsoftware@Arilas-MacBook-Air-2.local>
2024-07-30 09:30:39 -07:00

10 lines
583 B
Python

def migrate(cr, version):
cr.execute("""
INSERT INTO openems_alerting (device_id, device_name, user_id, user_login, offline_delay, warning_delay, fault_delay, offline_last_notification)
SELECT device_id, dev.name, user_id, usr.login, time_to_wait, 0, 0, last_notification
FROM openems_alerting_migrate AS migrate
LEFT JOIN openems_device AS dev ON dev.id = migrate.device_id
LEFT JOIN res_users AS usr ON usr.id = migrate.user_id
""")
cr.execute('DROP TABLE openems_alerting_migrate')