OCA reporting engine fork for dev and update.
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.

30 lines
1.1 KiB

  1. # Copyright 2021 Tecnativa - Víctor Martínez
  2. # Copyright 2021 Tecnativa - Pedro M: Baeza
  3. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  4. from openupgradelib import openupgrade
  5. from odoo.tools import parse_version
  6. field_renames = [
  7. ("base.comment.template", "base_comment_template", "priority", "sequence"),
  8. ]
  9. @openupgrade.migrate()
  10. def migrate(env, version):
  11. if parse_version(version) == parse_version("14.0.1.0.0"):
  12. openupgrade.rename_fields(env, field_renames)
  13. if openupgrade.table_exists(env.cr, "base_comment_template_res_partner_rel"):
  14. # Swap column names, as they were incorrect
  15. env.cr.execute(
  16. "ALTER TABLE base_comment_template_res_partner_rel "
  17. "RENAME base_comment_template_id TO temp"
  18. )
  19. env.cr.execute(
  20. "ALTER TABLE base_comment_template_res_partner_rel "
  21. "RENAME res_partner_id TO base_comment_template_id"
  22. )
  23. env.cr.execute(
  24. "ALTER TABLE base_comment_template_res_partner_rel "
  25. "RENAME temp TO res_partner_id"
  26. )