From 65603ccbc19451bdd23709201eae3ea22603df69 Mon Sep 17 00:00:00 2001 From: Lorenzo Battistini Date: Tue, 29 Jul 2014 15:40:50 +0200 Subject: [PATCH] [FIX] base_location PEP8 --- base_location/better_zip.py | 19 +++++++++++++------ base_location/company.py | 26 ++++++++++++++------------ base_location/partner.py | 20 +++++++++++--------- base_location/state.py | 7 ++++--- 4 files changed, 42 insertions(+), 30 deletions(-) diff --git a/base_location/better_zip.py b/base_location/better_zip.py index 3ab561245..c51644a12 100644 --- a/base_location/better_zip.py +++ b/base_location/better_zip.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -############################################################################## +# # # Author: Nicolas Bessi. Copyright Camptocamp SA # Contributor: Pedro Manuel Baeza @@ -18,11 +18,12 @@ # 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" @@ -57,19 +58,25 @@ class BetterZip(orm.Model): 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) + 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): + 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) + 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) + 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.py b/base_location/company.py index e90cd0422..35ef3d856 100644 --- a/base_location/company.py +++ b/base_location/company.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -############################################################################## +# # # Author: Nicolas Bessi. Copyright Camptocamp SA # Contributor: Pedro Manuel Baeza @@ -18,7 +18,7 @@ # 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 @@ -31,17 +31,19 @@ class ResCompany(orm.Model): 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 - } - } + 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 _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', '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/partner.py index b6db7bc8b..76218ecd5 100644 --- a/base_location/partner.py +++ b/base_location/partner.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -############################################################################## +# # # Author: Nicolas Bessi. Copyright Camptocamp SA # Contributor: Pedro Manuel Baeza @@ -18,7 +18,7 @@ # 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 @@ -31,10 +31,12 @@ class ResPartner(orm.Model): 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, - } - } + 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, + } + } diff --git a/base_location/state.py b/base_location/state.py index 4312384af..24cc81e20 100644 --- a/base_location/state.py +++ b/base_location/state.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -############################################################################## +# # # Author: Nicolas Bessi. Copyright Camptocamp SA # Contributor: Pedro Manuel Baeza @@ -18,7 +18,7 @@ # 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 @@ -26,4 +26,5 @@ class ResCountryState(orm.Model): _inherit = 'res.country.state' - _columns = {'better_zip_ids': fields.one2many('res.better.zip', 'state_id', 'Cities')} + _columns = {'better_zip_ids': fields.one2many( + 'res.better.zip', 'state_id', 'Cities')}