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.

19 lines
592 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 Nicolas Bessi, Copyright Camptocamp SA
  3. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
  4. from openerp import models, fields, api
  5. class ResPartner(models.Model):
  6. _inherit = 'res.partner'
  7. zip_id = fields.Many2one('res.better.zip', 'City/Location')
  8. @api.one
  9. @api.onchange('zip_id')
  10. def onchange_zip_id(self):
  11. if self.zip_id:
  12. self.zip = self.zip_id.name
  13. self.city = self.zip_id.city
  14. self.state_id = self.zip_id.state_id
  15. self.country_id = self.zip_id.country_id