diff --git a/debian/control b/debian/control
index acd4a72c44b..d5980232b73 100644
--- a/debian/control
+++ b/debian/control
@@ -19,6 +19,7 @@ Depends:
python-docutils,
python-feedparser,
python-gdata,
+ python-jinja2,
python-ldap,
python-libxslt1,
python-lxml,
diff --git a/openerp/addons/base/ir/ir_actions.py b/openerp/addons/base/ir/ir_actions.py
index 2eb764aa9b3..e5fe94d4e5a 100644
--- a/openerp/addons/base/ir/ir_actions.py
+++ b/openerp/addons/base/ir/ir_actions.py
@@ -670,7 +670,7 @@ class actions_server(osv.osv):
context['object'] = obj
for i in expr:
context['active_id'] = i.id
- result = self.run(cr, uid, [action.loop_action.id], context)
+ self.run(cr, uid, [action.loop_action.id], context)
if action.state == 'object_write':
res = {}
@@ -715,8 +715,6 @@ class actions_server(osv.osv):
expr = exp.value
res[exp.col1.name] = expr
- obj_pool = None
- res_id = False
obj_pool = self.pool.get(action.srcmodel_id.model)
res_id = obj_pool.create(cr, uid, res)
if action.record_id:
@@ -735,7 +733,7 @@ class actions_server(osv.osv):
model = action.copy_object.split(',')[0]
cid = action.copy_object.split(',')[1]
obj_pool = self.pool.get(model)
- res_id = obj_pool.copy(cr, uid, int(cid), res)
+ obj_pool.copy(cr, uid, int(cid), res)
return False
diff --git a/openerp/addons/base/ir/ir_cron.py b/openerp/addons/base/ir/ir_cron.py
index bdb04f94c57..790b4a43de0 100644
--- a/openerp/addons/base/ir/ir_cron.py
+++ b/openerp/addons/base/ir/ir_cron.py
@@ -226,7 +226,7 @@ class ir_cron(osv.osv):
_logger.warning('Tried to poll an undefined table on database %s.', db_name)
else:
raise
- except Exception, ex:
+ except Exception:
_logger.warning('Exception in cron:', exc_info=True)
finally:
diff --git a/openerp/addons/base/ir/ir_filters.py b/openerp/addons/base/ir/ir_filters.py
index aa7cb25d9f8..74665a1ffe3 100644
--- a/openerp/addons/base/ir/ir_filters.py
+++ b/openerp/addons/base/ir/ir_filters.py
@@ -24,9 +24,6 @@ from openerp.osv import osv, fields
from openerp.tools.translate import _
class ir_filters(osv.osv):
- '''
- Filters
- '''
_name = 'ir.filters'
_description = 'Filters'
diff --git a/openerp/addons/base/ir/ir_mail_server.py b/openerp/addons/base/ir/ir_mail_server.py
index 6af4d765145..0134cd5f197 100644
--- a/openerp/addons/base/ir/ir_mail_server.py
+++ b/openerp/addons/base/ir/ir_mail_server.py
@@ -227,7 +227,7 @@ class ir_mail_server(osv.osv):
:param int port: SMTP port to connect to
:param user: optional username to authenticate with
:param password: optional password to authenticate with
- :param string encryption: optional: ``'ssl'`` | ``'starttls'``
+ :param string encryption: optional, ``'ssl'`` | ``'starttls'``
:param bool smtp_debug: toggle debugging of SMTP sessions (all i/o
will be output in logs)
"""
diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py
index fcf1ee92ebd..ff43a15692f 100644
--- a/openerp/addons/base/ir/ir_model.py
+++ b/openerp/addons/base/ir/ir_model.py
@@ -158,9 +158,10 @@ class ir_model(osv.osv):
if context is None: context = {}
if isinstance(ids, (int, long)):
ids = [ids]
- if not context.get(MODULE_UNINSTALL_FLAG) and \
- any(model.state != 'manual' for model in self.browse(cr, user, ids, context)):
- raise except_orm(_('Error'), _("Model '%s' contains module data and cannot be removed!") % (model.name,))
+ if not context.get(MODULE_UNINSTALL_FLAG):
+ for model in self.browse(cr, user, ids, context):
+ if model.state != 'manual':
+ raise except_orm(_('Error'), _("Model '%s' contains module data and cannot be removed!") % (model.name,))
self._drop_table(cr, user, ids, context)
res = super(ir_model, self).unlink(cr, user, ids, context)
@@ -256,7 +257,7 @@ class ir_model_fields(osv.osv):
'selection': "",
'domain': "[]",
'name': 'x_',
- 'state': lambda self,cr,uid,ctx={}: (ctx and ctx.get('manual',False)) and 'manual' or 'base',
+ 'state': lambda self,cr,uid,ctx=None: (ctx and ctx.get('manual',False)) and 'manual' or 'base',
'on_delete': 'set null',
'select_level': '0',
'size': 64,
@@ -271,7 +272,7 @@ class ir_model_fields(osv.osv):
except Exception:
_logger.warning('Invalid selection list definition for fields.selection', exc_info=True)
raise except_orm(_('Error'),
- _("The Selection Options expression is not a valid Pythonic expression." \
+ _("The Selection Options expression is not a valid Pythonic expression."
"Please provide an expression in the [('key','Label'), ...] format."))
check = True
@@ -514,7 +515,7 @@ class ir_model_constraint(Model):
# double-check we are really going to delete all the owners of this schema element
cr.execute("""SELECT id from ir_model_constraint where name=%s""", (data.name,))
external_ids = [x[0] for x in cr.fetchall()]
- if (set(external_ids)-ids_set):
+ if set(external_ids)-ids_set:
# as installed modules have defined this element we must not delete it!
continue
@@ -567,13 +568,12 @@ class ir_model_relation(Model):
ids.reverse()
for data in self.browse(cr, uid, ids, context):
model = data.model
- model_obj = self.pool.get(model)
name = openerp.tools.ustr(data.name)
# double-check we are really going to delete all the owners of this schema element
cr.execute("""SELECT id from ir_model_relation where name = %s""", (data.name,))
external_ids = [x[0] for x in cr.fetchall()]
- if (set(external_ids)-ids_set):
+ if set(external_ids)-ids_set:
# as installed modules have defined this element we must not delete it!
continue
@@ -585,7 +585,7 @@ class ir_model_relation(Model):
# drop m2m relation tables
for table in to_drop_table:
- cr.execute('DROP TABLE %s CASCADE'% (table),)
+ cr.execute('DROP TABLE %s CASCADE'% table,)
_logger.info('Dropped table %s', table)
cr.commit()
@@ -862,7 +862,7 @@ class ir_model_data(osv.osv):
res = self.read(cr, uid, data_id, ['model', 'res_id'])
if not res['res_id']:
raise ValueError('No such external ID currently defined in the system: %s.%s' % (module, xml_id))
- return (res['model'], res['res_id'])
+ return res['model'], res['res_id']
def get_object(self, cr, uid, module, xml_id, context=None):
"""Returns a browsable record for the given module name and xml_id or raise ValueError if not found"""
@@ -903,7 +903,7 @@ class ir_model_data(osv.osv):
# records created during module install should not display the messages of OpenChatter
context = dict(context, install_mode=True)
if xml_id and ('.' in xml_id):
- assert len(xml_id.split('.'))==2, _("'%s' contains too many dots. XML ids should not contain dots ! These are used to refer to other modules data, as in module.reference_id") % (xml_id)
+ assert len(xml_id.split('.'))==2, _("'%s' contains too many dots. XML ids should not contain dots ! These are used to refer to other modules data, as in module.reference_id") % xml_id
module, xml_id = xml_id.split('.')
if (not xml_id) and (not self.doinit):
return False
@@ -1073,7 +1073,6 @@ class ir_model_data(osv.osv):
if model == 'ir.model.fields')
ir_model_relation = self.pool.get('ir.model.relation')
- relation_ids = ir_model_relation.search(cr, uid, [('module', 'in', modules_to_remove)])
ir_module_module = self.pool.get('ir.module.module')
modules_to_remove_ids = ir_module_module.search(cr, uid, [('name', 'in', modules_to_remove)])
relation_ids = ir_model_relation.search(cr, uid, [('module', 'in', modules_to_remove_ids)])
diff --git a/openerp/addons/base/ir/ir_needaction.py b/openerp/addons/base/ir/ir_needaction.py
index efbf9f7913e..1f51f4667e6 100644
--- a/openerp/addons/base/ir/ir_needaction.py
+++ b/openerp/addons/base/ir/ir_needaction.py
@@ -23,7 +23,7 @@ from openerp.osv import osv
class ir_needaction_mixin(osv.AbstractModel):
- '''Mixin class for objects using the need action feature.
+ """Mixin class for objects using the need action feature.
Need action feature can be used by models that have to be able to
signal that an action is required on a particular record. If in
@@ -37,7 +37,7 @@ class ir_needaction_mixin(osv.AbstractModel):
This class also offers several global services:
- ``_needaction_count``: returns the number of actions uid has to perform
- '''
+ """
_name = 'ir.needaction_mixin'
_needaction = True
@@ -56,7 +56,7 @@ class ir_needaction_mixin(osv.AbstractModel):
# "Need action" API
#------------------------------------------------------
- def _needaction_count(self, cr, uid, domain=[], context=None):
+ def _needaction_count(self, cr, uid, domain=None, context=None):
""" Get the number of actions uid has to perform. """
dom = self._needaction_domain_get(cr, uid, context=context)
if not dom:
diff --git a/openerp/addons/base/ir/ir_sequence.py b/openerp/addons/base/ir/ir_sequence.py
index 273d131c7f9..8ba94d37006 100644
--- a/openerp/addons/base/ir/ir_sequence.py
+++ b/openerp/addons/base/ir/ir_sequence.py
@@ -139,7 +139,7 @@ class ir_sequence(openerp.osv.osv.osv):
values = self._add_missing_default_values(cr, uid, values, context)
values['id'] = super(ir_sequence, self).create(cr, uid, values, context)
if values['implementation'] == 'standard':
- f = self._create_sequence(cr, values['id'], values['number_increment'], values['number_next'])
+ self._create_sequence(cr, values['id'], values['number_increment'], values['number_next'])
return values['id']
def unlink(self, cr, uid, ids, context=None):
diff --git a/openerp/addons/base/ir/ir_translation.py b/openerp/addons/base/ir/ir_translation.py
index 42b61e594bd..35547fe6f75 100644
--- a/openerp/addons/base/ir/ir_translation.py
+++ b/openerp/addons/base/ir/ir_translation.py
@@ -134,7 +134,7 @@ class ir_translation_import_cursor(object):
""" % (self._parent_table, self._table_name, self._parent_table, find_expr))
if self._debug:
- cr.execute('SELECT COUNT(*) FROM ONLY %s' % (self._parent_table))
+ cr.execute('SELECT COUNT(*) FROM ONLY %s' % self._parent_table)
c1 = cr.fetchone()[0]
cr.execute('SELECT COUNT(*) FROM ONLY %s AS irt, %s AS ti WHERE %s' % \
(self._parent_table, self._table_name, find_expr))
@@ -217,11 +217,11 @@ class ir_translation(osv.osv):
def _get_ids(self, cr, uid, name, tt, lang, ids):
translations = dict.fromkeys(ids, False)
if ids:
- cr.execute('select res_id,value ' \
- 'from ir_translation ' \
- 'where lang=%s ' \
- 'and type=%s ' \
- 'and name=%s ' \
+ cr.execute('select res_id,value '
+ 'from ir_translation '
+ 'where lang=%s '
+ 'and type=%s '
+ 'and name=%s '
'and res_id IN %s',
(lang,tt,name,tuple(ids)))
for res_id, value in cr.fetchall():
@@ -237,10 +237,10 @@ class ir_translation(osv.osv):
self._get_ids.clear_cache(self, uid, name, tt, lang, res_id)
self._get_source.clear_cache(self, uid, name, tt, lang)
- cr.execute('delete from ir_translation ' \
- 'where lang=%s ' \
- 'and type=%s ' \
- 'and name=%s ' \
+ cr.execute('delete from ir_translation '
+ 'where lang=%s '
+ 'and type=%s '
+ 'and name=%s '
'and res_id IN %s',
(lang,tt,name,tuple(ids),))
for id in ids:
diff --git a/openerp/addons/base/ir/ir_ui_menu.py b/openerp/addons/base/ir/ir_ui_menu.py
index c5d17c1ebf2..5da85c43577 100644
--- a/openerp/addons/base/ir/ir_ui_menu.py
+++ b/openerp/addons/base/ir/ir_ui_menu.py
@@ -44,9 +44,8 @@ class ir_ui_menu(osv.osv):
def __init__(self, *args, **kwargs):
self.cache_lock = threading.RLock()
self._cache = {}
- r = super(ir_ui_menu, self).__init__(*args, **kwargs)
+ super(ir_ui_menu, self).__init__(*args, **kwargs)
self.pool.get('ir.model.access').register_cache_clearing_method(self._name, 'clear_cache')
- return r
def clear_cache(self):
with self.cache_lock:
@@ -144,7 +143,7 @@ class ir_ui_menu(osv.osv):
return res
def _get_full_name(self, cr, uid, ids, name=None, args=None, context=None):
- if context == None:
+ if context is None:
context = {}
res = {}
for elmt in self.browse(cr, uid, ids, context=context):
@@ -195,7 +194,7 @@ class ir_ui_menu(osv.osv):
next_num=int(concat[0])+1
datas['name']=rex.sub(('(%d)'%next_num),datas['name'])
else:
- datas['name']=datas['name']+'(1)'
+ datas['name'] += '(1)'
self.write(cr,uid,[res],{'name':datas['name']})
ids = ir_values_obj.search(cr, uid, [
('model', '=', 'ir.ui.menu'),
diff --git a/openerp/addons/base/ir/ir_ui_view.py b/openerp/addons/base/ir/ir_ui_view.py
index 1e48c08f4e6..0b8ff4ee66f 100644
--- a/openerp/addons/base/ir/ir_ui_view.py
+++ b/openerp/addons/base/ir/ir_ui_view.py
@@ -255,7 +255,7 @@ class view(osv.osv):
if label:
for lbl in eval(label):
if t.has_key(tools.ustr(lbl)) and tools.ustr(t[lbl])=='False':
- label_string = label_string + ' '
+ label_string += ' '
else:
label_string = label_string + " " + tools.ustr(t[lbl])
labels[str(t['id'])] = (a['id'],label_string)
diff --git a/openerp/addons/base/ir/ir_values.py b/openerp/addons/base/ir/ir_values.py
index 3be6dca4d57..9e0c8e5ab9b 100644
--- a/openerp/addons/base/ir/ir_values.py
+++ b/openerp/addons/base/ir/ir_values.py
@@ -306,10 +306,10 @@ class ir_values(osv.osv):
ORDER BY v.user_id, u.company_id"""
params = ('default', model, uid, uid)
if condition:
- query = query % 'AND v.key2 = %s'
+ query %= 'AND v.key2 = %s'
params += (condition[:200],)
else:
- query = query % 'AND v.key2 is NULL'
+ query %= 'AND v.key2 is NULL'
cr.execute(query, params)
# keep only the highest priority default for each field
@@ -416,7 +416,7 @@ class ir_values(osv.osv):
continue
# keep only the first action registered for each action name
results[action['name']] = (action['id'], action['name'], action_def)
- except except_orm, e:
+ except except_orm:
continue
return sorted(results.values())
diff --git a/openerp/addons/base/ir/workflow/print_instance.py b/openerp/addons/base/ir/workflow/print_instance.py
index e7c8f935f32..706ee09d129 100644
--- a/openerp/addons/base/ir/workflow/print_instance.py
+++ b/openerp/addons/base/ir/workflow/print_instance.py
@@ -75,8 +75,10 @@ def graph_get(cr, graph, wkf_ids, nested, workitem, processed_subflows):
for t in transitions:
if not t['act_to'] in activities:
continue
- args = {}
- args['label'] = str(t['condition']).replace(' or ', '\\nor ').replace(' and ', '\\nand ')
+ args = {
+ 'label': str(t['condition']).replace(' or ', '\\nor ')
+ .replace(' and ','\\nand ')
+ }
if t['signal']:
args['label'] += '\\n'+str(t['signal'])
args['style'] = 'bold'
@@ -92,20 +94,19 @@ def graph_get(cr, graph, wkf_ids, nested, workitem, processed_subflows):
activity_from = actfrom[t['act_from']][1].get(t['signal'], actfrom[t['act_from']][0])
activity_to = actto[t['act_to']][1].get(t['signal'], actto[t['act_to']][0])
graph.add_edge(pydot.Edge( str(activity_from) ,str(activity_to), fontsize='10', **args))
- nodes = cr.dictfetchall()
+
cr.execute('select * from wkf_activity where flow_start=True and wkf_id in ('+','.join(['%s']*len(wkf_ids))+')', wkf_ids)
start = cr.fetchone()[0]
cr.execute("select 'subflow.'||name,id from wkf_activity where flow_stop=True and wkf_id in ("+','.join(['%s']*len(wkf_ids))+')', wkf_ids)
stop = cr.fetchall()
- if (stop):
+ if stop:
stop = (stop[0][1], dict(stop))
else:
stop = ("stop",{})
- return ((start,{}),stop)
+ return (start, {}), stop
def graph_instance_get(cr, graph, inst_id, nested=False):
- workitems = {}
cr.execute('select wkf_id from wkf_instance where id=%s', (inst_id,))
inst = cr.fetchall()
@@ -167,7 +168,7 @@ showpage'''
inst_id = inst_id[0]
graph_instance_get(cr, graph, inst_id, data.get('nested', False))
ps_string = graph.create(prog='dot', format='ps')
- except Exception, e:
+ except Exception:
_logger.exception('Exception in call:')
# string is in PS, like the success message would have been
ps_string = '''%PS-Adobe-3.0
@@ -204,13 +205,13 @@ class report_graph(report.interface.report_int):
def result(self):
if self.obj.is_done():
- return (True, self.obj.get(), 'pdf')
+ return True, self.obj.get(), 'pdf'
else:
- return (False, False, False)
+ return False, False, False
def create(self, cr, uid, ids, data, context=None):
self.obj = report_graph_instance(cr, uid, ids, data)
- return (self.obj.get(), 'pdf')
+ return self.obj.get(), 'pdf'
report_graph('report.workflow.instance.graph', 'ir.workflow')
diff --git a/openerp/addons/base/module/report/ir_module_reference.rml b/openerp/addons/base/module/report/ir_module_reference.rml
index 10117c7130a..00030a10596 100644
--- a/openerp/addons/base/module/report/ir_module_reference.rml
+++ b/openerp/addons/base/module/report/ir_module_reference.rml
@@ -3,16 +3,16 @@