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.

41 lines
938 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 Sodexis
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. def post_init_hook(cr, registry):
  5. """ Add street3 to address format """
  6. query = """
  7. UPDATE res_country
  8. SET address_format = replace(
  9. address_format,
  10. E'%(street2)s\n',
  11. E'%(street2)s\n%(street3)s\n'
  12. )
  13. """
  14. cr.execute(query)
  15. def uninstall_hook(cr, registry):
  16. """ Remove street3 from address format """
  17. # Remove %(street3)s\n from address_format
  18. query = """
  19. UPDATE res_country
  20. SET address_format = replace(
  21. address_format,
  22. E'%(street3)s\n',
  23. ''
  24. )
  25. """
  26. cr.execute(query)
  27. # Remove %(street3)s from address_format
  28. query = """
  29. UPDATE res_country
  30. SET address_format = replace(
  31. address_format,
  32. E'%(street3)s',
  33. ''
  34. )
  35. """
  36. cr.execute(query)