From 3500d55cd7d90f1493d41f0350bd6f7285706095 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Mon, 28 Jul 2014 10:33:34 +0200 Subject: [PATCH] [FIX] flake8, relative import, unused context initialization --- partner_relations/__init__.py | 2 +- partner_relations/model/__init__.py | 8 ++++---- partner_relations/model/res_partner.py | 13 +++++-------- .../model/res_partner_relation_type_selection.py | 10 +++++----- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/partner_relations/__init__.py b/partner_relations/__init__.py index 4d083ea93..9da2ac3b6 100644 --- a/partner_relations/__init__.py +++ b/partner_relations/__init__.py @@ -18,4 +18,4 @@ # along with this program. If not, see . # ############################################################################## -import model +from . import model diff --git a/partner_relations/model/__init__.py b/partner_relations/model/__init__.py index eb5702410..b5afe7aa1 100644 --- a/partner_relations/model/__init__.py +++ b/partner_relations/model/__init__.py @@ -18,8 +18,8 @@ # along with this program. If not, see . # ############################################################################## -import res_partner -import res_partner_relation -import res_partner_relation_type -import res_partner_relation_type_selection +from . import res_partner +from . import res_partner_relation +from . import res_partner_relation_type +from . import res_partner_relation_type_selection from . import res_partner_relation_all diff --git a/partner_relations/model/res_partner.py b/partner_relations/model/res_partner.py index 760bfce7b..1f6b8f2f4 100644 --- a/partner_relations/model/res_partner.py +++ b/partner_relations/model/res_partner.py @@ -30,10 +30,7 @@ class ResPartner(orm.Model): def _get_relation_ids( self, cr, uid, ids, dummy_name, dummy_arg, context=None): - if context is None: - context = {} - - #TODO: do a permission test on returned ids + # TODO: do a permission test on returned ids cr.execute( '''select id, left_partner_id, right_partner_id from res_partner_relation @@ -90,7 +87,7 @@ class ResPartner(orm.Model): result = [] for arg in args: if isinstance(arg, tuple) and arg[0] == name: - #TODO: handle {<,>}{,=} + # TODO: handle {<,>}{,=} if arg[1] != '=': continue @@ -190,8 +187,8 @@ class ResPartner(orm.Model): context=None, count=False): if context is None: context = {} - #inject searching for current relation date if we search for relation - #properties and no explicit date was given + # inject searching for current relation date if we search for relation + # properties and no explicit date was given date_args = [] for arg in args: if is_leaf(arg) and arg[0].startswith('search_relation'): @@ -203,7 +200,7 @@ class ResPartner(orm.Model): ('search_relation_date', '=', time.strftime( DEFAULT_SERVER_DATE_FORMAT))] - #because of auto_join, we have to do the active test by hand + # because of auto_join, we have to do the active test by hand active_args = [] if context.get('active_test', True): for arg in args: diff --git a/partner_relations/model/res_partner_relation_type_selection.py b/partner_relations/model/res_partner_relation_type_selection.py index 7d071f565..ee9b969d1 100644 --- a/partner_relations/model/res_partner_relation_type_selection.py +++ b/partner_relations/model/res_partner_relation_type_selection.py @@ -55,9 +55,9 @@ class ResPartnerRelationTypeSelection(orm.Model): def _auto_init(self, cr, context=None): drop_view_if_exists(cr, self._table) - #TODO: we lose field value's translations here. - #probably we need to patch ir_translation.get_source for that - #to get res_partner_relation_type's translations + # TODO: we lose field value's translations here. + # probably we need to patch ir_translation.get_source for that + # to get res_partner_relation_type's translations cr.execute( '''create or replace view %s as select @@ -91,7 +91,7 @@ class ResPartnerRelationTypeSelection(orm.Model): for arg in args: if isinstance(arg, tuple) and arg[0] == field_name\ and (arg[1] == '=' or arg[1] == 'in'): - #TODO don't we have an api function to eval that? + # TODO don't we have an api function to eval that? for delta in arg[2]: if delta[0] == 6: category_ids.extend(delta[2]) @@ -122,7 +122,7 @@ class ResPartnerRelationTypeSelection(orm.Model): 'res.partner.category', 'Current record\'s category'), 'partner_category_other': fields.many2one( 'res.partner.category', 'Other record\'s category'), - #search field to handle many2many deltas from the client + # search field to handle many2many deltas from the client 'search_partner_category_this': fields.function( lambda self, cr, uid, ids, context=None: dict( [(i, False) for i in ids]),