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.

25 lines
953 B

  1. # Copyright 2020 NextERP Romania SRL
  2. # Copyright 2021 Tecnativa - Víctor Martínez
  3. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  4. from openupgradelib import openupgrade
  5. @openupgrade.migrate()
  6. def migrate(env, version):
  7. # Not tested
  8. openupgrade.logged_query(
  9. env.cr,
  10. """
  11. INSERT INTO base_comment_template_res_partner_rel
  12. (res_partner_id, base_comment_template_id)
  13. SELECT SPLIT_PART(ip.res_id, ',', 2)::int AS res_partner_id,
  14. SPLIT_PART(ip.value_reference, ',', 2)::int AS base_comment_template_id
  15. FROM ir_property ip
  16. JOIN ir_model_fields imf ON ip.fields_id = imf.id
  17. JOIN res_partner rp ON rp.id = SPLIT_PART(ip.res_id, ',', 2)::int
  18. JOIN base_comment_template bct
  19. ON bct.id = SPLIT_PART(ip.value_reference, ',', 2)::int
  20. WHERE imf.name = 'property_comment_template_id'
  21. AND imf.model = 'res.partner'
  22. """,
  23. )