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.

26 lines
738 B

  1. # Copyright 2014-2020 Camptocamp SA
  2. # @author: Nicolas Bessi
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from odoo import api, fields, models
  5. class ResPartner(models.Model):
  6. """Add third field in address"""
  7. _inherit = "res.partner"
  8. street3 = fields.Char("Street 3")
  9. @api.model
  10. def _address_fields(self):
  11. res = super()._address_fields()
  12. res.append("street3")
  13. return res
  14. def _display_address(self, without_company=False):
  15. """Remove empty lines which can happen when street3 field is empty."""
  16. res = super()._display_address(without_company=without_company)
  17. while "\n\n" in res:
  18. res = res.replace("\n\n", "\n")
  19. return res