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.

40 lines
914 B

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