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.

27 lines
881 B

  1. # Copyright 2018 Eficent Business and IT Consulting Services, S.L.
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
  3. from openupgradelib import openupgrade
  4. from psycopg2.extensions import AsIs
  5. _column_renames = {
  6. 'res_partner': [('sector_id', None)],
  7. }
  8. _xmlid_renames = [
  9. ('partner_sector.group_use_partner_sector_for_person',
  10. 'partner_industry_secondary.group_use_partner_industry_for_person'),
  11. ]
  12. @openupgrade.migrate(use_env=True)
  13. def migrate(env, version):
  14. cr = env.cr
  15. if openupgrade.table_exists(cr, 'res_partner_sector'):
  16. openupgrade.rename_columns(cr, _column_renames)
  17. openupgrade.rename_xmlids(cr, _xmlid_renames)
  18. cr.execute(
  19. """
  20. ALTER TABLE res_partner_industry
  21. ADD COLUMN %s integer;
  22. """, (AsIs(openupgrade.get_legacy_name('old_sector_id')), ),
  23. )