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.

42 lines
1003 B

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