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.

18 lines
566 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 Nicolas Bessi, Camptocamp SA
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from odoo 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.onchange('zip_id')
  9. def onchange_zip_id(self):
  10. if self.zip_id:
  11. self.zip = self.zip_id.name
  12. self.city = self.zip_id.city
  13. self.state_id = self.zip_id.state_id
  14. self.country_id = self.zip_id.country_id