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.

36 lines
953 B

  1. # Copyright 2020 Tecnativa - Ernesto Tejeda
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  3. from openupgradelib import openupgrade
  4. @openupgrade.migrate()
  5. def migrate(env, version):
  6. openupgrade.logged_query(
  7. env.cr,
  8. """
  9. INSERT INTO customer_global_discount_rel
  10. (partner_id, global_discount_id)
  11. SELECT
  12. partner_id,
  13. global_discount_id
  14. FROM
  15. global_discount_res_partner_rel
  16. WHERE
  17. discount_scope = 'sale';
  18. """,
  19. )
  20. openupgrade.logged_query(
  21. env.cr,
  22. """
  23. INSERT INTO supplier_global_discount_rel
  24. (partner_id, global_discount_id)
  25. SELECT
  26. partner_id,
  27. field_id
  28. FROM
  29. global_discount_res_partner_rel
  30. WHERE
  31. discount_scope = 'purchase';
  32. """,
  33. )