From ed2a2d93688436dbffb82d56ede24feff5b71df1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Taymans?= Date: Fri, 14 Aug 2020 22:46:57 +0200 Subject: [PATCH] [ADD] b_shift: migrate shift status The 'draft' status does not exist in 12.0. Shift in the 'draft' status are moved to the 'cancel' status. --- .../migrations/12.0.1.0.0/pre-migration.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/beesdoo_shift/migrations/12.0.1.0.0/pre-migration.py b/beesdoo_shift/migrations/12.0.1.0.0/pre-migration.py index 414c162..bcdf831 100644 --- a/beesdoo_shift/migrations/12.0.1.0.0/pre-migration.py +++ b/beesdoo_shift/migrations/12.0.1.0.0/pre-migration.py @@ -36,8 +36,21 @@ def rename_config_parameters(cr, keys_spec): openupgrade.logged_query(cr, query, (new, old)) +def fix_shift_status(cr): + """ + The 'draft' status for the shift (a task) does not exist in 12.0. So + shift in this state will be moved to the 'cancel' state. + """ + query = ( + "UPDATE beesdoo_shift_shift SET state = 'cancel' " + "WHERE state = 'draft'" + ) + openupgrade.logged_query(cr, query) + + @openupgrade.migrate() def migrate(env, version): cr = env.cr openupgrade.rename_xmlids(cr, xmlid_renames) rename_config_parameters(cr, _config_param_renames) + fix_shift_status(cr)