diff --git a/base_external_dbsource/base_external_dbsource.py b/base_external_dbsource/base_external_dbsource.py index 9beb69e9e..888681f48 100644 --- a/base_external_dbsource/base_external_dbsource.py +++ b/base_external_dbsource/base_external_dbsource.py @@ -21,9 +21,14 @@ import os import logging + +import psycopg2 + from openerp.osv import orm, fields from openerp.tools.translate import _ import openerp.tools as tools + + _logger = logging.getLogger(__name__) CONNECTORS = [] @@ -62,7 +67,6 @@ except: _logger.info('Oracle libraries not available. Please install "cx_Oracle"\ python package.') -import psycopg2 CONNECTORS.append(('postgresql', 'PostgreSQL')) diff --git a/database_cleanup/model/purge_columns.py b/database_cleanup/model/purge_columns.py index 60b56ccc8..abcf1d2d4 100644 --- a/database_cleanup/model/purge_columns.py +++ b/database_cleanup/model/purge_columns.py @@ -96,8 +96,9 @@ class CleanupPurgeWizardColumn(orm.TransientModel): columns = list(set([ column for model_pool in model_pools for column in model_pool._columns - if not (isinstance(model_pool._columns[column], fields.function) - and not model_pool._columns[column].store) + if not (isinstance(model_pool._columns[column], + fields.function) and + not model_pool._columns[column].store) ])) columns += orm.MAGIC_COLUMNS columns += self.blacklist.get(model_pools[0]._table, []) diff --git a/database_cleanup/model/purge_tables.py b/database_cleanup/model/purge_tables.py index 8d9c86544..c108afce6 100644 --- a/database_cleanup/model/purge_tables.py +++ b/database_cleanup/model/purge_tables.py @@ -110,9 +110,8 @@ class CleanupPurgeWizardTable(orm.TransientModel): known_tables += [ column._sql_names(model_pool)[0] for column in model_pool._columns.values() - if column._type == 'many2many' + if column._type == 'many2many' and hasattr(column, '_rel') # unstored function fields of type m2m don't have _rel - and hasattr(column, '_rel') ] # Cannot pass table names as a psycopg argument diff --git a/email_template_dateutil/email_template.py b/email_template_dateutil/email_template.py index 765523d3c..dab6f8a72 100644 --- a/email_template_dateutil/email_template.py +++ b/email_template_dateutil/email_template.py @@ -22,7 +22,6 @@ from datetime import datetime import logging -_logger = logging.getLogger(__name__) import pytz from jinja2 import contextfilter @@ -34,6 +33,9 @@ from openerp.tools import ( from openerp.addons.email_template import email_template +_logger = logging.getLogger(__name__) + + @contextfilter def format_date(context, dtstr, new_format=None, tz=None): if not dtstr: diff --git a/import_odbc/import_odbc.py b/import_odbc/import_odbc.py index 02d2978f6..2ea5fd56c 100644 --- a/import_odbc/import_odbc.py +++ b/import_odbc/import_odbc.py @@ -90,15 +90,13 @@ class import_odbc_dbtable(orm.Model): def append_to_log(log, level, obj_id='', msg='', rel_id=''): if '_id_' in obj_id: - obj_id = ('.'.join(obj_id.split('_')[:-2]) - + ': ' - + obj_id.split('_')[-1]) + obj_id = ('.'.join(obj_id.split('_')[:-2]) + + ': ' + obj_id.split('_')[-1]) if ': .' in msg and not rel_id: rel_id = msg[msg.find(': .') + 3:] if '_id_' in rel_id: - rel_id = ('.'.join(rel_id.split('_')[:-2]) - + ': ' - + rel_id.split('_')[-1]) + rel_id = ('.'.join(rel_id.split('_')[:-2]) + + ': ' + rel_id.split('_')[-1]) msg = msg[:msg.find(': .')] log['last_log'].append('%s|%s\t|%s\t|%s' % (level.ljust(5), obj_id, diff --git a/mass_editing/mass_editing.py b/mass_editing/mass_editing.py index 1002e65c8..c0954f57f 100644 --- a/mass_editing/mass_editing.py +++ b/mass_editing/mass_editing.py @@ -32,8 +32,9 @@ class ir_model_fields(orm.Model): count=False): model_domain = [] for domain in args: - if (len(domain) > 2 and domain[0] == 'model_id' - and isinstance(domain[2], basestring)): + if (len(domain) > 2 and + domain[0] == 'model_id' and + isinstance(domain[2], basestring)): model_domain += [ ('model_id', 'in', map(int, domain[2][1:-1].split(','))) ] @@ -109,8 +110,7 @@ class mass_object(orm.Model): 'model': src_obj, 'key2': 'client_action_multi', 'value': ( - "ir.actions.act_window," - + str(vals['ref_ir_act_window'])), + "ir.actions.act_window,%s" % vals['ref_ir_act_window']), 'object': True, }, context) self.write(cr, uid, ids, { diff --git a/mass_editing/wizard/mass_editing_wizard.py b/mass_editing/wizard/mass_editing_wizard.py index e45cc9ec4..567598631 100644 --- a/mass_editing/wizard/mass_editing_wizard.py +++ b/mass_editing/wizard/mass_editing_wizard.py @@ -69,8 +69,8 @@ class mass_editing_wizard(orm.TransientModel): etree.SubElement(xml_group, 'field', { 'name': field.name, 'colspan': '4', 'nolabel': '1', 'attrs': ( - "{'invisible':[('selection__" - + field.name + "','=','remove_m2m')]}")}) + "{'invisible':[('selection__" + + field.name + "','=','remove_m2m')]}")}) elif field.ttype == "one2many": all_fields["selection__" + field.name] = { 'type': 'selection', @@ -84,8 +84,8 @@ class mass_editing_wizard(orm.TransientModel): etree.SubElement(xml_group, 'field', { 'name': field.name, 'colspan': '4', 'nolabel': '1', 'attrs': ( - "{'invisible':[('selection__" - + field.name + "','=','remove_o2m')]}")}) + "{'invisible':[('selection__" + + field.name + "','=','remove_o2m')]}")}) elif field.ttype == "many2one": all_fields["selection__" + field.name] = { 'type': 'selection', @@ -99,8 +99,8 @@ class mass_editing_wizard(orm.TransientModel): etree.SubElement(xml_group, 'field', { 'name': field.name, 'nolabel': '1', 'colspan': '2', 'attrs': ( - "{'invisible':[('selection__" - + field.name + "','=','remove')]}")}) + "{'invisible':[('selection__" + + field.name + "','=','remove')]}")}) elif field.ttype == "char": all_fields["selection__" + field.name] = { 'type': 'selection', @@ -115,8 +115,8 @@ class mass_editing_wizard(orm.TransientModel): etree.SubElement(xml_group, 'field', { 'name': field.name, 'nolabel': '1', 'attrs': ( - "{'invisible':[('selection__" - + field.name + "','=','remove')]}"), + "{'invisible':[('selection__" + + field.name + "','=','remove')]}"), 'colspan': '2'}) elif field.ttype == 'selection': all_fields["selection__" + field.name] = { @@ -128,8 +128,8 @@ class mass_editing_wizard(orm.TransientModel): etree.SubElement(xml_group, 'field', { 'name': field.name, 'nolabel': '1', 'colspan': '2', 'attrs': ( - "{'invisible':[('selection__" - + field.name + "','=','remove')]}")}) + "{'invisible':[('selection__" + + field.name + "','=','remove')]}")}) all_fields[field.name] = { 'type': field.ttype, 'string': field.field_description, @@ -153,8 +153,8 @@ class mass_editing_wizard(orm.TransientModel): etree.SubElement(xml_group, 'field', { 'name': field.name, 'colspan': '4', 'nolabel': '1', 'attrs': ( - "{'invisible':[('selection__" - + field.name + "','=','remove')]}")}) + "{'invisible':[('selection__" + + field.name + "','=','remove')]}")}) else: all_fields["selection__" + field.name] = { 'type': 'selection', @@ -167,8 +167,8 @@ class mass_editing_wizard(orm.TransientModel): etree.SubElement(xml_group, 'field', { 'name': field.name, 'nolabel': '1', 'attrs': ( - "{'invisible':[('selection__" - + field.name + "','=','remove')]}"), + "{'invisible':[('selection__" + + field.name + "','=','remove')]}"), 'colspan': '2', }) etree.SubElement( xml_form, 'separator', {'string': '', 'colspan': '4'}) diff --git a/server_environment/serv_config.py b/server_environment/serv_config.py index 0a2447463..feb8da81b 100644 --- a/server_environment/serv_config.py +++ b/server_environment/serv_config.py @@ -107,8 +107,9 @@ class _Defaults(dict): __slots__ = () def __setitem__(self, key, value): - func = lambda *a: str(value) - return dict.__setitem__(self, key, func) + return dict.__setitem__(self, + key, + lambda *a: str(value)) class ServerConfiguration(orm.TransientModel): diff --git a/users_ldap_groups/users_ldap_groups.py b/users_ldap_groups/users_ldap_groups.py index ff0ca32aa..4e2b3ecbf 100644 --- a/users_ldap_groups/users_ldap_groups.py +++ b/users_ldap_groups/users_ldap_groups.py @@ -36,8 +36,8 @@ class CompanyLDAPGroupMapping(orm.Model): operators = [] members = inspect.getmembers( users_ldap_groups_operators, - lambda cls: inspect.isclass(cls) - and cls != users_ldap_groups_operators.LDAPOperator) + lambda cls: (inspect.isclass(cls) and + cls != users_ldap_groups_operators.LDAPOperator)) for name, operator in members: operators.append((name, name)) return tuple(operators) diff --git a/users_ldap_mail/__openerp__.py b/users_ldap_mail/__openerp__.py index 3c46f1736..58d89e613 100644 --- a/users_ldap_mail/__openerp__.py +++ b/users_ldap_mail/__openerp__.py @@ -23,7 +23,8 @@ 'name': "LDAP mapping for user name and e-mail", 'version': "1.0", 'depends': ["auth_ldap"], - 'author': "Daniel Reis (https://launchpad.com/~dreis-pt),Odoo Community Association (OCA)", + 'author': "Daniel Reis (https://launchpad.com/~dreis-pt)," + "Odoo Community Association (OCA)", 'description': """\ Allows to define the LDAP attributes to use to retrieve user name and e-mail address.