You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.5 KiB

  1. from openupgradelib import openupgrade
  2. xmlid_renames = [
  3. # data/cron.xml
  4. ('beesdoo_shift.ir_cron_check_non_validated_sheet',
  5. 'beesdoo_shift_attendance.ir_cron_check_non_validated_sheet'),
  6. # data/email_template.xml
  7. ('beesdoo_shift.email_template_non_validated_sheet',
  8. 'beesdoo_shift_attendance.email_template_non_validated_sheet'),
  9. ('beesdoo_shift.email_template_non_attendance',
  10. 'beesdoo_shift_attendance.email_template_non_attendance'),
  11. # data/system_parameter.xml
  12. ('beesdoo_shift.card_support',
  13. 'beesdoo_shift_attendance.card_support'),
  14. ('beesdoo_shift.attendance_sheet_generation_interval',
  15. 'beesdoo_shift_attendance.attendance_sheet_generation_interval'),
  16. # security/group.xml
  17. ('beesdoo_shift.group_shift_attendance_sheet',
  18. 'beesdoo_shift_attendance.group_shift_attendance_sheet'),
  19. ('beesdoo_shift.group_shift_attendance_sheet_validation',
  20. 'beesdoo_shift_attendance.group_shift_attendance_sheet_validation'),
  21. ]
  22. _config_param_renames = [
  23. ('beesdoo_shift.default_task_type_id',
  24. 'beesdoo_shift_attendance.pre_filled_task_type_id'),
  25. ]
  26. def rename_config_parameters(cr, keys_spec):
  27. for (old, new) in keys_spec:
  28. query = ("UPDATE ir_config_parameter SET key = %s "
  29. "WHERE key = %s")
  30. openupgrade.logged_query(cr, query, (new, old))
  31. @openupgrade.migrate()
  32. def migrate(env, version):
  33. cr = env.cr
  34. openupgrade.rename_xmlids(cr, xmlid_renames)
  35. rename_config_parameters(cr, _config_param_renames)