Browse Source

[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.
pull/154/head
Rémy Taymans 4 years ago
parent
commit
ed2a2d9368
  1. 13
      beesdoo_shift/migrations/12.0.1.0.0/pre-migration.py

13
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)) 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() @openupgrade.migrate()
def migrate(env, version): def migrate(env, version):
cr = env.cr cr = env.cr
openupgrade.rename_xmlids(cr, xmlid_renames) openupgrade.rename_xmlids(cr, xmlid_renames)
rename_config_parameters(cr, _config_param_renames) rename_config_parameters(cr, _config_param_renames)
fix_shift_status(cr)
Loading…
Cancel
Save