From 9c82d94f73edb1f87f4dff7b947c52dd5dc32250 Mon Sep 17 00:00:00 2001 From: Alejandro Santana Date: Mon, 19 Jan 2015 00:35:12 +0100 Subject: [PATCH 1/5] [IMP] base_location: Updated to v8 syntax and uses. Added filters in some views. Added two columns in respective tree views. --- base_location/__init__.py | 6 +- base_location/__openerp__.py | 35 ++++---- base_location/better_zip.py | 82 ------------------- base_location/company_view.xml | 20 ----- base_location/models/__init__.py | 10 +++ base_location/models/better_zip.py | 68 +++++++++++++++ base_location/{ => models}/company.py | 40 ++++----- base_location/{ => models}/partner.py | 33 ++++---- base_location/{ => models}/state.py | 8 +- base_location/partner_view.xml | 30 ------- .../better_zip.xml} | 12 ++- base_location/views/company.xml | 19 +++++ base_location/views/partner.xml | 26 ++++++ base_location/views/res_country.xml | 36 ++++++++ .../{state_view.xml => views/state.xml} | 0 15 files changed, 227 insertions(+), 198 deletions(-) delete mode 100644 base_location/better_zip.py delete mode 100644 base_location/company_view.xml create mode 100644 base_location/models/__init__.py create mode 100644 base_location/models/better_zip.py rename base_location/{ => models}/company.py (52%) rename base_location/{ => models}/partner.py (55%) rename base_location/{ => models}/state.py (81%) delete mode 100644 base_location/partner_view.xml rename base_location/{better_zip_view.xml => views/better_zip.xml} (81%) create mode 100644 base_location/views/company.xml create mode 100644 base_location/views/partner.xml create mode 100644 base_location/views/res_country.xml rename base_location/{state_view.xml => views/state.xml} (100%) diff --git a/base_location/__init__.py b/base_location/__init__.py index 878769646..bb01c93ee 100644 --- a/base_location/__init__.py +++ b/base_location/__init__.py @@ -4,6 +4,7 @@ # Author: Nicolas Bessi. Copyright Camptocamp SA # Contributor: Pedro Manuel Baeza # Ignacio Ibeas +# Alejandro Santana # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -20,7 +21,4 @@ # ############################################################################## -from . import better_zip -from . import partner -from . import state -from . import company +from . import models diff --git a/base_location/__openerp__.py b/base_location/__openerp__.py index 6ed991501..943648ac1 100644 --- a/base_location/__openerp__.py +++ b/base_location/__openerp__.py @@ -4,6 +4,7 @@ # Author: Nicolas Bessi. Copyright Camptocamp SA # Contributor: Pedro Manuel Baeza # Ignacio Ibeas +# Alejandro Santana # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -19,19 +20,21 @@ # along with this program. If not, see . # ############################################################################## -{'name': 'Location management (aka Better ZIP)', - 'version': '0.3.1', - 'depends': ['base'], - 'author': 'Camptocamp', - 'description': """ -Introduces a better zip/npa management system. -It enables zip/city auto-completion on partners""", - 'website': 'http://www.camptocamp.com', - 'data': ['better_zip_view.xml', - 'state_view.xml', - 'company_view.xml', - 'partner_view.xml', - 'security/ir.model.access.csv'], - 'installable': True, - 'active': False, - } +{ + 'name': 'Location management (aka Better ZIP)', + 'version': '0.3.2', + 'depends': ['base'], + 'author': 'Camptocamp', + 'description': ''' + Introduces a better zip/npa management system. + It enables zip/city auto-completion on partners.''', + 'website': 'http://www.camptocamp.com', + 'data': ['views/better_zip.xml', + 'views/state.xml', + 'views/res_country.xml', + 'views/company.xml', + 'views/partner.xml', + 'security/ir.model.access.csv'], + 'installable': True, + 'active': False, +} diff --git a/base_location/better_zip.py b/base_location/better_zip.py deleted file mode 100644 index c51644a12..000000000 --- a/base_location/better_zip.py +++ /dev/null @@ -1,82 +0,0 @@ -# -*- coding: utf-8 -*- -# -# -# Author: Nicolas Bessi. Copyright Camptocamp SA -# Contributor: Pedro Manuel Baeza -# Ignacio Ibeas -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -# -from openerp.osv import orm, fields - - -class BetterZip(orm.Model): - - " City/locations completion object" - - _name = "res.better.zip" - _description = __doc__ - _order = "priority" - - _columns = {'priority': fields.integer('Priority', deprecated=True), - 'name': fields.char('ZIP'), - 'city': fields.char('City', required=True), - 'state_id': fields.many2one('res.country.state', 'State'), - 'country_id': fields.many2one('res.country', 'Country'), - 'code': fields.char('City Code', size=64, - help="The official code for the city"), - } - - _defaults = {'priority': 100} - - def name_get(self, cursor, uid, ids, context=None): - res = [] - for bzip in self.browse(cursor, uid, ids, context=context): - if bzip.name: - name = [bzip.name, bzip.city] - else: - name = [bzip.city] - if bzip.state_id: - name.append(bzip.state_id.name) - if bzip.country_id: - name.append(bzip.country_id.name) - res.append((bzip.id, ", ".join(name))) - return res - - def onchange_state_id(self, cr, uid, ids, state_id=False, context=None): - result = {} - if state_id: - state = self.pool['res.country.state'].browse( - cr, uid, state_id, context=context) - if state: - result['value'] = {'country_id': state.country_id.id} - return result - - def name_search( - self, cr, uid, name, args=None, operator='ilike', context=None, - limit=100 - ): - if args is None: - args = [] - if context is None: - context = {} - ids = [] - if name: - ids = self.search( - cr, uid, [('name', 'ilike', name)] + args, limit=limit) - if not ids: - ids = self.search( - cr, uid, [('city', operator, name)] + args, limit=limit) - return self.name_get(cr, uid, ids, context=context) diff --git a/base_location/company_view.xml b/base_location/company_view.xml deleted file mode 100644 index 9aa24e358..000000000 --- a/base_location/company_view.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - res.company.form.city - res.company - - - - - - - - - diff --git a/base_location/models/__init__.py b/base_location/models/__init__.py new file mode 100644 index 000000000..351a33ad1 --- /dev/null +++ b/base_location/models/__init__.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# +# License, author and contributors information in: +# __openerp__.py file at the root folder of this module. +# + +from . import better_zip +from . import partner +from . import state +from . import company diff --git a/base_location/models/better_zip.py b/base_location/models/better_zip.py new file mode 100644 index 000000000..412d1e8f7 --- /dev/null +++ b/base_location/models/better_zip.py @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- +# +# +# Author: Nicolas Bessi. Copyright Camptocamp SA +# Contributor: Pedro Manuel Baeza +# Ignacio Ibeas +# Alejandro Santana +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +from openerp import models, fields, api + + +class BetterZip(models.Model): + '''City/locations completion object''' + + _name = "res.better.zip" + _description = __doc__ + _order = "priority" + + priority = fields.Integer('Priority', default=100, deprecated=True) + name = fields.Char('ZIP') + code = fields.Char('City Code', size=64, + help="The official code for the city") + city = fields.Char('City', required=True) + state_id = fields.Many2one('res.country.state', 'State') + country_id = fields.Many2one('res.country', 'Country') + + @api.multi + def name_get(self): + res = [] + for bzip in self: + if bzip.name: + name = [bzip.name, bzip.city] + else: + name = [bzip.city] + if bzip.state_id: + name.append(bzip.state_id.name) + if bzip.country_id: + name.append(bzip.country_id.name) + res.append((bzip.id, ", ".join(name))) + return res + + @api.onchange('state_id') + def onchange_state_id(self): + if self.state_id: + self.country_id = self.state_id.country_id + + @api.model + def name_search(self, name, args=None, operator='ilike', limit=100): + args = args or [] + recs = self.browse() + if name: + recs = self.search([('name', 'ilike', name)] + args, limit=limit) + if not recs: + recs = self.search([('city', operator, name)] + args, limit=limit) + return recs.name_get() diff --git a/base_location/company.py b/base_location/models/company.py similarity index 52% rename from base_location/company.py rename to base_location/models/company.py index 35ef3d856..33e2b923a 100644 --- a/base_location/company.py +++ b/base_location/models/company.py @@ -4,6 +4,7 @@ # Author: Nicolas Bessi. Copyright Camptocamp SA # Contributor: Pedro Manuel Baeza # Ignacio Ibeas +# Alejandro Santana # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -19,31 +20,26 @@ # along with this program. If not, see . # # -from openerp.osv import orm, fields +from openerp import models, fields, api -class ResCompany(orm.Model): +class ResCompany(models.Model): _inherit = 'res.company' - def on_change_city(self, cr, uid, ids, zip_id, context=None): - result = {} - if context is None: - context = {} - if zip_id: - bzip = self.pool['res.better.zip'].browse( - cr, uid, zip_id, context=context) - result = {'value': { - 'zip': bzip.name, - 'country_id': bzip.country_id.id if bzip.country_id else False, - 'city': bzip.city, - 'state_id': bzip.state_id.id if bzip.state_id else False - } - } - return result + @api.multi + @api.onchange('better_zip_id') + def on_change_city(self): + for record in self: + if record.better_zip_id: + record.zip = record.better_zip_id.name + record.city = record.better_zip_id.city + record.state_id = record.better_zip_id.state_id or False + record.country_id = record.better_zip_id.country_id or False - _columns = { - 'better_zip_id': fields.many2one( - 'res.better.zip', 'Location', select=1, - help=('Use the city name or the zip code to search the location')), - } + better_zip_id = fields.Many2one( + 'res.better.zip', + string='Location', + select=1, + help=('Use the city name or the zip code to search the location'), + ) diff --git a/base_location/partner.py b/base_location/models/partner.py similarity index 55% rename from base_location/partner.py rename to base_location/models/partner.py index 76218ecd5..3dc7fe99b 100644 --- a/base_location/partner.py +++ b/base_location/models/partner.py @@ -4,6 +4,7 @@ # Author: Nicolas Bessi. Copyright Camptocamp SA # Contributor: Pedro Manuel Baeza # Ignacio Ibeas +# Alejandro Santana # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -19,24 +20,20 @@ # along with this program. If not, see . # # -from openerp.osv import orm, fields +from openerp import models, fields, api -class ResPartner(orm.Model): - _inherit = "res.partner" - _columns = {'zip_id': fields.many2one('res.better.zip', 'City/Location')} +class ResPartner(models.Model): + _inherit = 'res.partner' + zip_id = fields.Many2one('res.better.zip', 'City/Location') - def onchange_zip_id(self, cursor, uid, ids, zip_id, context=None): - if not zip_id: - return {} - if isinstance(zip_id, list): - zip_id = zip_id[0] - bzip = self.pool['res.better.zip'].browse( - cursor, uid, zip_id, context=context) - return {'value': { - 'zip': bzip.name, - 'city': bzip.city, - 'country_id': bzip.country_id.id if bzip.country_id else False, - 'state_id': bzip.state_id.id if bzip.state_id else False, - } - } + @api.multi + @api.onchange('zip_id') + def onchange_zip_id(self): + for record in self: + if record.zip_id: + bzip = record.zip_id[0] + record.zip = bzip.name + record.city = bzip.city + record.state_id = bzip.state_id or False + record.country_id = bzip.country_id or False diff --git a/base_location/state.py b/base_location/models/state.py similarity index 81% rename from base_location/state.py rename to base_location/models/state.py index 24cc81e20..d9db12e50 100644 --- a/base_location/state.py +++ b/base_location/models/state.py @@ -4,6 +4,7 @@ # Author: Nicolas Bessi. Copyright Camptocamp SA # Contributor: Pedro Manuel Baeza # Ignacio Ibeas +# Alejandro Santana # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -19,12 +20,11 @@ # along with this program. If not, see . # # -from openerp.osv import orm, fields +from openerp import models, fields -class ResCountryState(orm.Model): +class ResCountryState(models.Model): _inherit = 'res.country.state' - _columns = {'better_zip_ids': fields.one2many( - 'res.better.zip', 'state_id', 'Cities')} + better_zip_ids = fields.One2many('res.better.zip', 'state_id', 'Cities') diff --git a/base_location/partner_view.xml b/base_location/partner_view.xml deleted file mode 100644 index ae4e3190c..000000000 --- a/base_location/partner_view.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - res.partner.zip_id.2 - res.partner - - -
- -
- - - -
-
-
-
diff --git a/base_location/better_zip_view.xml b/base_location/views/better_zip.xml similarity index 81% rename from base_location/better_zip_view.xml rename to base_location/views/better_zip.xml index de67ec1af..221bfb977 100644 --- a/base_location/better_zip_view.xml +++ b/base_location/views/better_zip.xml @@ -12,7 +12,7 @@ - + @@ -27,6 +27,7 @@ + @@ -39,11 +40,18 @@ + + + + + + + - + Cites/locations Management res.better.zip diff --git a/base_location/views/company.xml b/base_location/views/company.xml new file mode 100644 index 000000000..32c955a05 --- /dev/null +++ b/base_location/views/company.xml @@ -0,0 +1,19 @@ + + + + + + res.company.form.city + res.company + + + + + + + + + diff --git a/base_location/views/partner.xml b/base_location/views/partner.xml new file mode 100644 index 000000000..7e7b4cc0d --- /dev/null +++ b/base_location/views/partner.xml @@ -0,0 +1,26 @@ + + + + + res.partner.zip_id.2 + res.partner + + +
+ +
+ + + +
+
+ +
+
diff --git a/base_location/views/res_country.xml b/base_location/views/res_country.xml new file mode 100644 index 000000000..5bdb089a5 --- /dev/null +++ b/base_location/views/res_country.xml @@ -0,0 +1,36 @@ + + + + + + res.country.search + res.country + + + + + + + + + + res.country.tree + res.country + + + + + + + + + + + + + + + + + + diff --git a/base_location/state_view.xml b/base_location/views/state.xml similarity index 100% rename from base_location/state_view.xml rename to base_location/views/state.xml From ff3c3bd4029bf956498b33fe16ca7af41fbd1288 Mon Sep 17 00:00:00 2001 From: Alejandro Santana Date: Mon, 19 Jan 2015 01:33:24 +0100 Subject: [PATCH 2/5] [FIX] base_contact: Fixed PEP8. [IMP] base_location: Removed non-relevan currency_id column on country tree view, enhanced description and manidest, addded README.rst file. --- base_location/README.rst | 20 ++++++++++++++++++++ base_location/__openerp__.py | 15 ++++++++++++--- base_location/models/partner.py | 2 +- base_location/views/res_country.xml | 19 ------------------- 4 files changed, 33 insertions(+), 23 deletions(-) create mode 100644 base_location/README.rst diff --git a/base_location/README.rst b/base_location/README.rst new file mode 100644 index 000000000..817183a5b --- /dev/null +++ b/base_location/README.rst @@ -0,0 +1,20 @@ +Enhanced ZIP management +======================= + +This module introduces a better zip/npa management system. + +It enables zip, city, state and country auto-completion on partners and companies. + +Also allows different search filters. + + +Author +------ + +- Nicolas Bessi. (Copyright Camptocamp SA) + +Contributors +------------ +- Ignacio Ibeas (Acysos S.L.) +- Pedro M. Baeza +- Alejandro Santana diff --git a/base_location/__openerp__.py b/base_location/__openerp__.py index 943648ac1..1281ea1c3 100644 --- a/base_location/__openerp__.py +++ b/base_location/__openerp__.py @@ -22,12 +22,21 @@ ############################################################################## { 'name': 'Location management (aka Better ZIP)', - 'version': '0.3.2', + 'version': '1.0', 'depends': ['base'], 'author': 'Camptocamp', + 'license': "AGPL-3", + 'contributors': [ + 'Pedro M. Baeza ', + 'Ignacio Ibeas (Acysos S.L.)', + 'Alejandro Santana ', + ], + 'summary': '''Enhanced zip/npa management system''', 'description': ''' - Introduces a better zip/npa management system. - It enables zip/city auto-completion on partners.''', + This module introduces a better zip/npa management system. + It enables zip, city, state and country auto-completion on partners and + companies. + Also allows different search filters.''', 'website': 'http://www.camptocamp.com', 'data': ['views/better_zip.xml', 'views/state.xml', diff --git a/base_location/models/partner.py b/base_location/models/partner.py index 3dc7fe99b..7bb0833d2 100644 --- a/base_location/models/partner.py +++ b/base_location/models/partner.py @@ -25,7 +25,7 @@ from openerp import models, fields, api class ResPartner(models.Model): _inherit = 'res.partner' - zip_id = fields.Many2one('res.better.zip', 'City/Location') + zip_id = fields.Many2one('res.better.zip', 'City/Location') @api.multi @api.onchange('zip_id') diff --git a/base_location/views/res_country.xml b/base_location/views/res_country.xml index 5bdb089a5..a2ed80258 100644 --- a/base_location/views/res_country.xml +++ b/base_location/views/res_country.xml @@ -12,25 +12,6 @@
- - - res.country.tree - res.country - - - - - - - - - - - - - - - From f7f02a6eb3500073f8bd25bec5cedf67f381c0de Mon Sep 17 00:00:00 2001 From: Alejandro Santana Date: Wed, 21 Jan 2015 14:20:36 +0100 Subject: [PATCH 3/5] [FIX] base_location: Fix flake8 error, views naming, removing deprecated fields. Also use @api.one in onchanges. Using now spaces instead of tabs in xml files. --- base_location/__openerp__.py | 15 ++--- base_location/models/better_zip.py | 3 +- base_location/models/company.py | 15 +++-- base_location/models/partner.py | 15 +++-- base_location/views/better_zip.xml | 71 ------------------------ base_location/views/better_zip_view.xml | 70 +++++++++++++++++++++++ base_location/views/company.xml | 19 ------- base_location/views/company_view.xml | 21 +++++++ base_location/views/partner.xml | 26 --------- base_location/views/partner_view.xml | 27 +++++++++ base_location/views/res_country.xml | 17 ------ base_location/views/res_country_view.xml | 17 ++++++ base_location/views/state.xml | 26 --------- base_location/views/state_view.xml | 26 +++++++++ 14 files changed, 181 insertions(+), 187 deletions(-) delete mode 100644 base_location/views/better_zip.xml create mode 100644 base_location/views/better_zip_view.xml delete mode 100644 base_location/views/company.xml create mode 100644 base_location/views/company_view.xml delete mode 100644 base_location/views/partner.xml create mode 100644 base_location/views/partner_view.xml delete mode 100644 base_location/views/res_country.xml create mode 100644 base_location/views/res_country_view.xml delete mode 100644 base_location/views/state.xml create mode 100644 base_location/views/state_view.xml diff --git a/base_location/__openerp__.py b/base_location/__openerp__.py index 1281ea1c3..d37507884 100644 --- a/base_location/__openerp__.py +++ b/base_location/__openerp__.py @@ -32,17 +32,12 @@ 'Alejandro Santana ', ], 'summary': '''Enhanced zip/npa management system''', - 'description': ''' - This module introduces a better zip/npa management system. - It enables zip, city, state and country auto-completion on partners and - companies. - Also allows different search filters.''', 'website': 'http://www.camptocamp.com', - 'data': ['views/better_zip.xml', - 'views/state.xml', - 'views/res_country.xml', - 'views/company.xml', - 'views/partner.xml', + 'data': ['views/better_zip_view.xml', + 'views/state_view.xml', + 'views/res_country_view.xml', + 'views/company_view.xml', + 'views/partner_view.xml', 'security/ir.model.access.csv'], 'installable': True, 'active': False, diff --git a/base_location/models/better_zip.py b/base_location/models/better_zip.py index 412d1e8f7..3f86f8ed4 100644 --- a/base_location/models/better_zip.py +++ b/base_location/models/better_zip.py @@ -27,9 +27,8 @@ class BetterZip(models.Model): _name = "res.better.zip" _description = __doc__ - _order = "priority" + _order = "name asc" - priority = fields.Integer('Priority', default=100, deprecated=True) name = fields.Char('ZIP') code = fields.Char('City Code', size=64, help="The official code for the city") diff --git a/base_location/models/company.py b/base_location/models/company.py index 33e2b923a..6368761cf 100644 --- a/base_location/models/company.py +++ b/base_location/models/company.py @@ -27,19 +27,18 @@ class ResCompany(models.Model): _inherit = 'res.company' - @api.multi + @api.one @api.onchange('better_zip_id') def on_change_city(self): - for record in self: - if record.better_zip_id: - record.zip = record.better_zip_id.name - record.city = record.better_zip_id.city - record.state_id = record.better_zip_id.state_id or False - record.country_id = record.better_zip_id.country_id or False + if self.better_zip_id: + self.zip = self.better_zip_id.name + self.city = self.better_zip_id.city + self.state_id = self.better_zip_id.state_id + self.country_id = self.better_zip_id.country_id better_zip_id = fields.Many2one( 'res.better.zip', string='Location', select=1, - help=('Use the city name or the zip code to search the location'), + help='Use the city name or the zip code to search the location', ) diff --git a/base_location/models/partner.py b/base_location/models/partner.py index 7bb0833d2..b0234d8a7 100644 --- a/base_location/models/partner.py +++ b/base_location/models/partner.py @@ -27,13 +27,12 @@ class ResPartner(models.Model): _inherit = 'res.partner' zip_id = fields.Many2one('res.better.zip', 'City/Location') - @api.multi + @api.one @api.onchange('zip_id') def onchange_zip_id(self): - for record in self: - if record.zip_id: - bzip = record.zip_id[0] - record.zip = bzip.name - record.city = bzip.city - record.state_id = bzip.state_id or False - record.country_id = bzip.country_id or False + if self.zip_id: + bzip = self.zip_id[0] + self.zip = bzip.name + self.city = bzip.city + self.state_id = bzip.state_id + self.country_id = bzip.country_id diff --git a/base_location/views/better_zip.xml b/base_location/views/better_zip.xml deleted file mode 100644 index 221bfb977..000000000 --- a/base_location/views/better_zip.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - res.better.zip.form - res.better.zip - -
- - - - - - - - -
-
-
- - - res.better.zip.tree - res.better.zip - - - - - - - - - - - - - - res.better.zip.select - res.better.zip - - - - - - - - - - - - - - - - - Cites/locations Management - res.better.zip - form - tree,form - - - - - -
-
diff --git a/base_location/views/better_zip_view.xml b/base_location/views/better_zip_view.xml new file mode 100644 index 000000000..d0e1782a7 --- /dev/null +++ b/base_location/views/better_zip_view.xml @@ -0,0 +1,70 @@ + + + + + + res.better.zip.form + res.better.zip + +
+ + + + + + + +
+
+
+ + + res.better.zip.tree + res.better.zip + + + + + + + + + + + + + res.better.zip.select + res.better.zip + + + + + + + + + + + + + + + + + Cites/locations Management + res.better.zip + form + tree,form + + + + + + +
+
diff --git a/base_location/views/company.xml b/base_location/views/company.xml deleted file mode 100644 index 32c955a05..000000000 --- a/base_location/views/company.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - res.company.form.city - res.company - - - - - - - - - diff --git a/base_location/views/company_view.xml b/base_location/views/company_view.xml new file mode 100644 index 000000000..e723db3a7 --- /dev/null +++ b/base_location/views/company_view.xml @@ -0,0 +1,21 @@ + + + + + + + res.company.form.city + res.company + + + + + + + + + + diff --git a/base_location/views/partner.xml b/base_location/views/partner.xml deleted file mode 100644 index 7e7b4cc0d..000000000 --- a/base_location/views/partner.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - res.partner.zip_id.2 - res.partner - - -
- -
- - - -
-
- -
-
diff --git a/base_location/views/partner_view.xml b/base_location/views/partner_view.xml new file mode 100644 index 000000000..517a179e9 --- /dev/null +++ b/base_location/views/partner_view.xml @@ -0,0 +1,27 @@ + + + + + + res.partner.zip_id.2 + res.partner + + +
+ +
+ + + +
+
+ +
+
diff --git a/base_location/views/res_country.xml b/base_location/views/res_country.xml deleted file mode 100644 index a2ed80258..000000000 --- a/base_location/views/res_country.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - res.country.search - res.country - - - - - - - - - - diff --git a/base_location/views/res_country_view.xml b/base_location/views/res_country_view.xml new file mode 100644 index 000000000..7e1deaa09 --- /dev/null +++ b/base_location/views/res_country_view.xml @@ -0,0 +1,17 @@ + + + + + + res.country.search + res.country + + + + + + + + + + diff --git a/base_location/views/state.xml b/base_location/views/state.xml deleted file mode 100644 index 96497c9e5..000000000 --- a/base_location/views/state.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - view_country_state_form2 - res.country.state - - - - - - - - - - - - - - - - diff --git a/base_location/views/state_view.xml b/base_location/views/state_view.xml new file mode 100644 index 000000000..38b550c97 --- /dev/null +++ b/base_location/views/state_view.xml @@ -0,0 +1,26 @@ + + + + + + view_country_state_form2 + res.country.state + + + + + + + + + + + + + + + + From 2220fbdbecec537b9ab1c3cb74eb84ddaeb868c6 Mon Sep 17 00:00:00 2001 From: Alejandro Santana Date: Wed, 21 Jan 2015 15:02:22 +0100 Subject: [PATCH 4/5] [DEL] better_zip: Removed deprecated symlink better_zip pointing to base_location. --- better_zip | 1 - 1 file changed, 1 deletion(-) delete mode 120000 better_zip diff --git a/better_zip b/better_zip deleted file mode 120000 index 1a26d595b..000000000 --- a/better_zip +++ /dev/null @@ -1 +0,0 @@ -base_location \ No newline at end of file From 97243078a9c06e55e3ef9ef4895e1e79ffce5ff0 Mon Sep 17 00:00:00 2001 From: Alejandro Santana Date: Wed, 21 Jan 2015 21:30:43 +0100 Subject: [PATCH 5/5] [FIX] base_location: Removed unnecesary temporary variable. --- base_location/models/partner.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/base_location/models/partner.py b/base_location/models/partner.py index b0234d8a7..c16ae83b1 100644 --- a/base_location/models/partner.py +++ b/base_location/models/partner.py @@ -31,8 +31,7 @@ class ResPartner(models.Model): @api.onchange('zip_id') def onchange_zip_id(self): if self.zip_id: - bzip = self.zip_id[0] - self.zip = bzip.name - self.city = bzip.city - self.state_id = bzip.state_id - self.country_id = bzip.country_id + self.zip = self.zip_id.name + self.city = self.zip_id.city + self.state_id = self.zip_id.state_id + self.country_id = self.zip_id.country_id