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.

27 lines
799 B

  1. # © 2014-2016 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. fields = super(ResPartner, self)._address_fields()
  12. fields.append('street3')
  13. return fields
  14. @api.multi
  15. def _display_address(self, without_company=False):
  16. """Remove empty lines which can happen when street3 field is empty."""
  17. res = super(ResPartner, self)._display_address(
  18. without_company=without_company)
  19. while '\n\n' in res:
  20. res = res.replace('\n\n', '\n')
  21. return res