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.

24 lines
714 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 ResCompany(models.Model):
  6. _inherit = 'res.company'
  7. @api.onchange('better_zip_id')
  8. def on_change_city(self):
  9. if self.better_zip_id:
  10. self.zip = self.better_zip_id.name
  11. self.city = self.better_zip_id.city
  12. self.state_id = self.better_zip_id.state_id
  13. self.country_id = self.better_zip_id.country_id
  14. better_zip_id = fields.Many2one(
  15. 'res.better.zip',
  16. string='Location',
  17. help='Use the city name or the zip code to search the location',
  18. )