Browse Source
Merge pull request #581 from Tecnativa/10.0-base_location-onchange_state
[10.0][IMP] base_location: Include onchange for state
pull/590/head
Pedro M. Baeza
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
14 additions and
1 deletions
-
base_location/__manifest__.py
-
base_location/models/company.py
-
base_location/models/partner.py
|
|
@ -1,10 +1,11 @@ |
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
# Copyright 2016 Nicolas Bessi, Camptocamp SA |
|
|
|
# Copyright 2018 Tecnativa - Pedro M. Baeza |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
|
|
|
|
|
{ |
|
|
|
'name': 'Location management (aka Better ZIP)', |
|
|
|
'version': '10.0.1.0.1', |
|
|
|
'version': '10.0.1.0.2', |
|
|
|
'depends': [ |
|
|
|
'base', |
|
|
|
], |
|
|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
# Copyright 2016 Nicolas Bessi, Camptocamp SA |
|
|
|
# Copyright 2018 Tecnativa - Pedro M. Baeza |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
|
|
|
|
|
from odoo import models, fields, api |
|
|
@ -22,3 +23,8 @@ class ResCompany(models.Model): |
|
|
|
string='Location', |
|
|
|
help='Use the city name or the zip code to search the location', |
|
|
|
) |
|
|
|
|
|
|
|
@api.onchange('state_id') |
|
|
|
def onchange_state_id(self): |
|
|
|
if self.state_id.country_id: |
|
|
|
self.country_id = self.state_id.country_id.id |
|
|
@ -1,5 +1,6 @@ |
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
# Copyright 2016 Nicolas Bessi, Camptocamp SA |
|
|
|
# Copyright 2018 Tecnativa - Pedro M. Baeza |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
|
|
|
|
|
from odoo import models, fields, api |
|
|
@ -16,3 +17,8 @@ class ResPartner(models.Model): |
|
|
|
self.city = self.zip_id.city |
|
|
|
self.state_id = self.zip_id.state_id |
|
|
|
self.country_id = self.zip_id.country_id |
|
|
|
|
|
|
|
@api.onchange('state_id') |
|
|
|
def onchange_state_id(self): |
|
|
|
if self.state_id.country_id: |
|
|
|
self.country_id = self.state_id.country_id.id |