[REM] unnecessary parens
bzr revid: xmo@openerp.com-20121214123803-6xu2s1ndnoyj4i3e
This commit is contained in:
parent
e83d615830
commit
c6079dd6bb
|
@ -514,7 +514,7 @@ class ir_model_constraint(Model):
|
||||||
# double-check we are really going to delete all the owners of this schema element
|
# 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,))
|
cr.execute("""SELECT id from ir_model_constraint where name=%s""", (data.name,))
|
||||||
external_ids = [x[0] for x in cr.fetchall()]
|
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!
|
# as installed modules have defined this element we must not delete it!
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -573,7 +573,7 @@ class ir_model_relation(Model):
|
||||||
# double-check we are really going to delete all the owners of this schema element
|
# 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,))
|
cr.execute("""SELECT id from ir_model_relation where name = %s""", (data.name,))
|
||||||
external_ids = [x[0] for x in cr.fetchall()]
|
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!
|
# as installed modules have defined this element we must not delete it!
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -585,7 +585,7 @@ class ir_model_relation(Model):
|
||||||
|
|
||||||
# drop m2m relation tables
|
# drop m2m relation tables
|
||||||
for table in to_drop_table:
|
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)
|
_logger.info('Dropped table %s', table)
|
||||||
|
|
||||||
cr.commit()
|
cr.commit()
|
||||||
|
@ -862,7 +862,7 @@ class ir_model_data(osv.osv):
|
||||||
res = self.read(cr, uid, data_id, ['model', 'res_id'])
|
res = self.read(cr, uid, data_id, ['model', 'res_id'])
|
||||||
if not res['res_id']:
|
if not res['res_id']:
|
||||||
raise ValueError('No such external ID currently defined in the system: %s.%s' % (module, xml_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):
|
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"""
|
"""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
|
# records created during module install should not display the messages of OpenChatter
|
||||||
context = dict(context, install_mode=True)
|
context = dict(context, install_mode=True)
|
||||||
if xml_id and ('.' in xml_id):
|
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('.')
|
module, xml_id = xml_id.split('.')
|
||||||
if (not xml_id) and (not self.doinit):
|
if (not xml_id) and (not self.doinit):
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -134,7 +134,7 @@ class ir_translation_import_cursor(object):
|
||||||
""" % (self._parent_table, self._table_name, self._parent_table, find_expr))
|
""" % (self._parent_table, self._table_name, self._parent_table, find_expr))
|
||||||
|
|
||||||
if self._debug:
|
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]
|
c1 = cr.fetchone()[0]
|
||||||
cr.execute('SELECT COUNT(*) FROM ONLY %s AS irt, %s AS ti WHERE %s' % \
|
cr.execute('SELECT COUNT(*) FROM ONLY %s AS irt, %s AS ti WHERE %s' % \
|
||||||
(self._parent_table, self._table_name, find_expr))
|
(self._parent_table, self._table_name, find_expr))
|
||||||
|
|
|
@ -101,11 +101,11 @@ def graph_get(cr, graph, wkf_ids, nested, workitem, processed_subflows):
|
||||||
start = cr.fetchone()[0]
|
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)
|
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()
|
stop = cr.fetchall()
|
||||||
if (stop):
|
if stop:
|
||||||
stop = (stop[0][1], dict(stop))
|
stop = (stop[0][1], dict(stop))
|
||||||
else:
|
else:
|
||||||
stop = ("stop",{})
|
stop = ("stop",{})
|
||||||
return ((start,{}),stop)
|
return (start, {}), stop
|
||||||
|
|
||||||
|
|
||||||
def graph_instance_get(cr, graph, inst_id, nested=False):
|
def graph_instance_get(cr, graph, inst_id, nested=False):
|
||||||
|
@ -208,13 +208,13 @@ class report_graph(report.interface.report_int):
|
||||||
|
|
||||||
def result(self):
|
def result(self):
|
||||||
if self.obj.is_done():
|
if self.obj.is_done():
|
||||||
return (True, self.obj.get(), 'pdf')
|
return True, self.obj.get(), 'pdf'
|
||||||
else:
|
else:
|
||||||
return (False, False, False)
|
return False, False, False
|
||||||
|
|
||||||
def create(self, cr, uid, ids, data, context=None):
|
def create(self, cr, uid, ids, data, context=None):
|
||||||
self.obj = report_graph_instance(cr, uid, ids, data)
|
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')
|
report_graph('report.workflow.instance.graph', 'ir.workflow')
|
||||||
|
|
||||||
|
|
|
@ -309,7 +309,7 @@ class res_config_installer(osv.osv_memory):
|
||||||
|
|
||||||
hooks_results = set()
|
hooks_results = set()
|
||||||
for module in base:
|
for module in base:
|
||||||
hook = getattr(self, '_if_%s'%(module), None)
|
hook = getattr(self, '_if_%s'% module, None)
|
||||||
if hook:
|
if hook:
|
||||||
hooks_results.update(hook(cr, uid, ids, context=None) or set())
|
hooks_results.update(hook(cr, uid, ids, context=None) or set())
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ class res_currency(osv.osv):
|
||||||
res = super(res_currency, self).read(cr, user, ids, fields, context, load)
|
res = super(res_currency, self).read(cr, user, ids, fields, context, load)
|
||||||
currency_rate_obj = self.pool.get('res.currency.rate')
|
currency_rate_obj = self.pool.get('res.currency.rate')
|
||||||
values = res
|
values = res
|
||||||
if not isinstance(values, (list)):
|
if not isinstance(values, list):
|
||||||
values = [values]
|
values = [values]
|
||||||
for r in values:
|
for r in values:
|
||||||
if r.__contains__('rate_ids'):
|
if r.__contains__('rate_ids'):
|
||||||
|
@ -217,7 +217,7 @@ class res_currency(osv.osv):
|
||||||
if round:
|
if round:
|
||||||
return self.round(cr, uid, to_currency, from_amount * rate)
|
return self.round(cr, uid, to_currency, from_amount * rate)
|
||||||
else:
|
else:
|
||||||
return (from_amount * rate)
|
return from_amount * rate
|
||||||
|
|
||||||
res_currency()
|
res_currency()
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ class lang(osv.osv):
|
||||||
thousands_sep = lang_obj.thousands_sep or conv[monetary and 'mon_thousands_sep' or 'thousands_sep']
|
thousands_sep = lang_obj.thousands_sep or conv[monetary and 'mon_thousands_sep' or 'thousands_sep']
|
||||||
decimal_point = lang_obj.decimal_point
|
decimal_point = lang_obj.decimal_point
|
||||||
grouping = lang_obj.grouping
|
grouping = lang_obj.grouping
|
||||||
return (grouping, thousands_sep, decimal_point)
|
return grouping, thousands_sep, decimal_point
|
||||||
|
|
||||||
def write(self, cr, uid, ids, vals, context=None):
|
def write(self, cr, uid, ids, vals, context=None):
|
||||||
for lang_id in ids :
|
for lang_id in ids :
|
||||||
|
@ -231,7 +231,7 @@ lang()
|
||||||
def original_group(s, grouping, thousands_sep=''):
|
def original_group(s, grouping, thousands_sep=''):
|
||||||
|
|
||||||
if not grouping:
|
if not grouping:
|
||||||
return (s, 0)
|
return s, 0
|
||||||
|
|
||||||
result = ""
|
result = ""
|
||||||
seps = 0
|
seps = 0
|
||||||
|
|
|
@ -309,7 +309,7 @@ class res_partner(osv.osv, format_address):
|
||||||
if default is None:
|
if default is None:
|
||||||
default = {}
|
default = {}
|
||||||
name = self.read(cr, uid, [id], ['name'], context)[0]['name']
|
name = self.read(cr, uid, [id], ['name'], context)[0]['name']
|
||||||
default.update({'name': _('%s (copy)') % (name)})
|
default.update({'name': _('%s (copy)') % name})
|
||||||
return super(res_partner, self).copy(cr, uid, id, default, context)
|
return super(res_partner, self).copy(cr, uid, id, default, context)
|
||||||
|
|
||||||
def onchange_type(self, cr, uid, ids, is_company, context=None):
|
def onchange_type(self, cr, uid, ids, is_company, context=None):
|
||||||
|
@ -519,7 +519,7 @@ class res_partner(osv.osv, format_address):
|
||||||
def view_header_get(self, cr, uid, view_id, view_type, context):
|
def view_header_get(self, cr, uid, view_id, view_type, context):
|
||||||
res = super(res_partner, self).view_header_get(cr, uid, view_id, view_type, context)
|
res = super(res_partner, self).view_header_get(cr, uid, view_id, view_type, context)
|
||||||
if res: return res
|
if res: return res
|
||||||
if (not context.get('category_id', False)):
|
if not context.get('category_id', False):
|
||||||
return False
|
return False
|
||||||
return _('Partners: ')+self.pool.get('res.partner.category').browse(cr, uid, context['category_id'], context).name
|
return _('Partners: ')+self.pool.get('res.partner.category').browse(cr, uid, context['category_id'], context).name
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ class res_request(osv.osv):
|
||||||
ids = map(lambda x:x[0], cr.fetchall())
|
ids = map(lambda x:x[0], cr.fetchall())
|
||||||
cr.execute('select id from res_request where act_from=%s and (act_to<>%s) and (trigger_date<=%s or trigger_date is null) and active=True and state != %s', (uid,uid,time.strftime('%Y-%m-%d'), 'closed'))
|
cr.execute('select id from res_request where act_from=%s and (act_to<>%s) and (trigger_date<=%s or trigger_date is null) and active=True and state != %s', (uid,uid,time.strftime('%Y-%m-%d'), 'closed'))
|
||||||
ids2 = map(lambda x:x[0], cr.fetchall())
|
ids2 = map(lambda x:x[0], cr.fetchall())
|
||||||
return (ids, ids2)
|
return ids, ids2
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'create_date': fields.datetime('Created Date', readonly=True),
|
'create_date': fields.datetime('Created Date', readonly=True),
|
||||||
|
|
|
@ -68,10 +68,10 @@ def execute(connector, method, *args):
|
||||||
except socket.error,e:
|
except socket.error,e:
|
||||||
if e.args[0] == 111:
|
if e.args[0] == 111:
|
||||||
if wait_count > wait_limit:
|
if wait_count > wait_limit:
|
||||||
print "Server is taking too long to start, it has exceeded the maximum limit of %d seconds."%(wait_limit)
|
print "Server is taking too long to start, it has exceeded the maximum limit of %d seconds." % wait_limit
|
||||||
clean()
|
clean()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
print 'Please wait %d sec to start server....'%(waittime)
|
print 'Please wait %d sec to start server....' % waittime
|
||||||
wait_count += 1
|
wait_count += 1
|
||||||
time.sleep(waittime)
|
time.sleep(waittime)
|
||||||
res = execute(connector, method, *args)
|
res = execute(connector, method, *args)
|
||||||
|
@ -137,7 +137,7 @@ def check_quality(uri, user, pwd, dbname, modules, quality_logs):
|
||||||
detail_html +='''<div id=\"%s\"><h3>%s (Score : %s)</h3><font color=red><h5>%s</h5></font>%s</div>'''%(test.replace(' ', '-'), test, score, msg, detail.get('detail', ''))
|
detail_html +='''<div id=\"%s\"><h3>%s (Score : %s)</h3><font color=red><h5>%s</h5></font>%s</div>'''%(test.replace(' ', '-'), test, score, msg, detail.get('detail', ''))
|
||||||
test_detail[test] = (score,msg,detail.get('detail',''))
|
test_detail[test] = (score,msg,detail.get('detail',''))
|
||||||
html += "</ul>"
|
html += "</ul>"
|
||||||
html += "%s"%(detail_html)
|
html += "%s"% detail_html
|
||||||
html += "</div></body></html>"
|
html += "</div></body></html>"
|
||||||
if not os.path.isdir(quality_logs):
|
if not os.path.isdir(quality_logs):
|
||||||
os.mkdir(quality_logs)
|
os.mkdir(quality_logs)
|
||||||
|
|
|
@ -110,7 +110,7 @@ def get_encodings(hint_encoding='utf-8'):
|
||||||
|
|
||||||
# some defaults (also taking care of pure ASCII)
|
# some defaults (also taking care of pure ASCII)
|
||||||
for charset in ['utf8','latin1']:
|
for charset in ['utf8','latin1']:
|
||||||
if not (hint_encoding) or (charset.lower() != hint_encoding.lower()):
|
if not hint_encoding or (charset.lower() != hint_encoding.lower()):
|
||||||
yield charset
|
yield charset
|
||||||
|
|
||||||
from locale import getpreferredencoding
|
from locale import getpreferredencoding
|
||||||
|
|
|
@ -340,11 +340,11 @@ def generate_table_alias(src_table_alias, joined_tables=[]):
|
||||||
"""
|
"""
|
||||||
alias = src_table_alias
|
alias = src_table_alias
|
||||||
if not joined_tables:
|
if not joined_tables:
|
||||||
return ('%s' % alias, '%s' % _quote(alias))
|
return '%s' % alias, '%s' % _quote(alias)
|
||||||
for link in joined_tables:
|
for link in joined_tables:
|
||||||
alias += '__' + link[1]
|
alias += '__' + link[1]
|
||||||
assert len(alias) < 64, 'Table alias name %s is longer than the 64 characters size accepted by default in postgresql.' % (alias)
|
assert len(alias) < 64, 'Table alias name %s is longer than the 64 characters size accepted by default in postgresql.' % alias
|
||||||
return ('%s' % alias, '%s as %s' % (_quote(joined_tables[-1][0]), _quote(alias)))
|
return '%s' % alias, '%s as %s' % (_quote(joined_tables[-1][0]), _quote(alias))
|
||||||
|
|
||||||
|
|
||||||
def get_alias_from_query(from_query):
|
def get_alias_from_query(from_query):
|
||||||
|
@ -356,9 +356,9 @@ def get_alias_from_query(from_query):
|
||||||
"""
|
"""
|
||||||
from_splitted = from_query.split(' as ')
|
from_splitted = from_query.split(' as ')
|
||||||
if len(from_splitted) > 1:
|
if len(from_splitted) > 1:
|
||||||
return (from_splitted[0].replace('"', ''), from_splitted[1].replace('"', ''))
|
return from_splitted[0].replace('"', ''), from_splitted[1].replace('"', '')
|
||||||
else:
|
else:
|
||||||
return (from_splitted[0].replace('"', ''), from_splitted[0].replace('"', ''))
|
return from_splitted[0].replace('"', ''), from_splitted[0].replace('"', '')
|
||||||
|
|
||||||
|
|
||||||
def normalize_leaf(element):
|
def normalize_leaf(element):
|
||||||
|
@ -377,7 +377,7 @@ def normalize_leaf(element):
|
||||||
if isinstance(right, (list, tuple)) and operator in ('=', '!='):
|
if isinstance(right, (list, tuple)) and operator in ('=', '!='):
|
||||||
_logger.warning("The domain term '%s' should use the 'in' or 'not in' operator." % ((left, original, right),))
|
_logger.warning("The domain term '%s' should use the 'in' or 'not in' operator." % ((left, original, right),))
|
||||||
operator = 'in' if operator == '=' else 'not in'
|
operator = 'in' if operator == '=' else 'not in'
|
||||||
return (left, operator, right)
|
return left, operator, right
|
||||||
|
|
||||||
|
|
||||||
def is_operator(element):
|
def is_operator(element):
|
||||||
|
@ -829,7 +829,7 @@ class expression(object):
|
||||||
push(create_substitution_leaf(leaf, AND_OPERATOR, relational_model))
|
push(create_substitution_leaf(leaf, AND_OPERATOR, relational_model))
|
||||||
|
|
||||||
elif len(field_path) > 1 and field._auto_join:
|
elif len(field_path) > 1 and field._auto_join:
|
||||||
raise NotImplementedError('_auto_join attribute not supported on many2many field %s' % (left))
|
raise NotImplementedError('_auto_join attribute not supported on many2many field %s' % left)
|
||||||
|
|
||||||
elif len(field_path) > 1 and field._type == 'many2one':
|
elif len(field_path) > 1 and field._type == 'many2one':
|
||||||
right_ids = relational_model.search(cr, uid, [(field_path[1], operator, right)], context=context)
|
right_ids = relational_model.search(cr, uid, [(field_path[1], operator, right)], context=context)
|
||||||
|
@ -989,7 +989,7 @@ class expression(object):
|
||||||
res_ids = [x[0] for x in relational_model.name_search(cr, uid, right, [], operator, limit=None, context=c)]
|
res_ids = [x[0] for x in relational_model.name_search(cr, uid, right, [], operator, limit=None, context=c)]
|
||||||
if operator in NEGATIVE_TERM_OPERATORS:
|
if operator in NEGATIVE_TERM_OPERATORS:
|
||||||
res_ids.append(False) # TODO this should not be appended if False was in 'right'
|
res_ids.append(False) # TODO this should not be appended if False was in 'right'
|
||||||
return (left, 'in', res_ids)
|
return left, 'in', res_ids
|
||||||
# resolve string-based m2o criterion into IDs
|
# resolve string-based m2o criterion into IDs
|
||||||
if isinstance(right, basestring) or \
|
if isinstance(right, basestring) or \
|
||||||
right and isinstance(right, (tuple, list)) and all(isinstance(item, basestring) for item in right):
|
right and isinstance(right, (tuple, list)) and all(isinstance(item, basestring) for item in right):
|
||||||
|
@ -1140,8 +1140,8 @@ class expression(object):
|
||||||
query = '%s."%s" IS NOT NULL' % (table_alias, left)
|
query = '%s."%s" IS NOT NULL' % (table_alias, left)
|
||||||
params = []
|
params = []
|
||||||
|
|
||||||
elif (operator == '=?'):
|
elif operator == '=?':
|
||||||
if (right is False or right is None):
|
if right is False or right is None:
|
||||||
# '=?' is a short-circuit that makes the term TRUE if right is None or False
|
# '=?' is a short-circuit that makes the term TRUE if right is None or False
|
||||||
query = 'TRUE'
|
query = 'TRUE'
|
||||||
params = []
|
params = []
|
||||||
|
@ -1187,7 +1187,7 @@ class expression(object):
|
||||||
|
|
||||||
if isinstance(params, basestring):
|
if isinstance(params, basestring):
|
||||||
params = [params]
|
params = [params]
|
||||||
return (query, params)
|
return query, params
|
||||||
|
|
||||||
def to_sql(self):
|
def to_sql(self):
|
||||||
stack = []
|
stack = []
|
||||||
|
@ -1213,6 +1213,6 @@ class expression(object):
|
||||||
if joins:
|
if joins:
|
||||||
query = '(%s) AND %s' % (joins, query)
|
query = '(%s) AND %s' % (joins, query)
|
||||||
|
|
||||||
return (query, tools.flatten(params))
|
return query, tools.flatten(params)
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -668,7 +668,7 @@ class many2many(_column):
|
||||||
col1 = '%s_id' % source_model._table
|
col1 = '%s_id' % source_model._table
|
||||||
if not col2:
|
if not col2:
|
||||||
col2 = '%s_id' % dest_model._table
|
col2 = '%s_id' % dest_model._table
|
||||||
return (tbl, col1, col2)
|
return tbl, col1, col2
|
||||||
|
|
||||||
def _get_query_and_where_params(self, cr, model, ids, values, where_params):
|
def _get_query_and_where_params(self, cr, model, ids, values, where_params):
|
||||||
""" Extracted from ``get`` to facilitate fine-tuning of the generated
|
""" Extracted from ``get`` to facilitate fine-tuning of the generated
|
||||||
|
|
|
@ -454,7 +454,7 @@ class browse_record(object):
|
||||||
new_data[field_name] = browse_null()
|
new_data[field_name] = browse_null()
|
||||||
elif field_column._type in ('one2many', 'many2many') and len(result_line[field_name]):
|
elif field_column._type in ('one2many', 'many2many') and len(result_line[field_name]):
|
||||||
new_data[field_name] = self._list_class([browse_record(self._cr, self._uid, id, self._table.pool.get(field_column._obj), self._cache, context=self._context, list_class=self._list_class, fields_process=self._fields_process) for id in result_line[field_name]], self._context)
|
new_data[field_name] = self._list_class([browse_record(self._cr, self._uid, id, self._table.pool.get(field_column._obj), self._cache, context=self._context, list_class=self._list_class, fields_process=self._fields_process) for id in result_line[field_name]], self._context)
|
||||||
elif field_column._type in ('reference'):
|
elif field_column._type in 'reference':
|
||||||
if result_line[field_name]:
|
if result_line[field_name]:
|
||||||
if isinstance(result_line[field_name], browse_record):
|
if isinstance(result_line[field_name], browse_record):
|
||||||
new_data[field_name] = result_line[field_name]
|
new_data[field_name] = result_line[field_name]
|
||||||
|
@ -1741,7 +1741,7 @@ class BaseModel(object):
|
||||||
views = {}
|
views = {}
|
||||||
xml = "<form>"
|
xml = "<form>"
|
||||||
for f in node:
|
for f in node:
|
||||||
if f.tag in ('field'):
|
if f.tag in 'field':
|
||||||
xml += etree.tostring(f, encoding="utf-8")
|
xml += etree.tostring(f, encoding="utf-8")
|
||||||
xml += "</form>"
|
xml += "</form>"
|
||||||
new_xml = etree.fromstring(encode(xml))
|
new_xml = etree.fromstring(encode(xml))
|
||||||
|
@ -2010,7 +2010,7 @@ class BaseModel(object):
|
||||||
view = etree.Element('calendar', string=self._description)
|
view = etree.Element('calendar', string=self._description)
|
||||||
etree.SubElement(view, 'field', self._rec_name_fallback(cr, user, context))
|
etree.SubElement(view, 'field', self._rec_name_fallback(cr, user, context))
|
||||||
|
|
||||||
if (self._date_name not in self._columns):
|
if self._date_name not in self._columns:
|
||||||
date_found = False
|
date_found = False
|
||||||
for dt in ['date', 'date_start', 'x_date', 'x_date_start']:
|
for dt in ['date', 'date_start', 'x_date', 'x_date_start']:
|
||||||
if dt in self._columns:
|
if dt in self._columns:
|
||||||
|
@ -2031,7 +2031,7 @@ class BaseModel(object):
|
||||||
self._columns, 'date_delay'):
|
self._columns, 'date_delay'):
|
||||||
raise except_orm(
|
raise except_orm(
|
||||||
_('Invalid Object Architecture!'),
|
_('Invalid Object Architecture!'),
|
||||||
_("Insufficient fields to generate a Calendar View for %s, missing a date_stop or a date_delay" % (self._name)))
|
_("Insufficient fields to generate a Calendar View for %s, missing a date_stop or a date_delay" % self._name))
|
||||||
|
|
||||||
return view
|
return view
|
||||||
|
|
||||||
|
@ -3097,7 +3097,7 @@ class BaseModel(object):
|
||||||
else:
|
else:
|
||||||
default = self._defaults[k]
|
default = self._defaults[k]
|
||||||
|
|
||||||
if (default is not None):
|
if default is not None:
|
||||||
ss = self._columns[k]._symbol_set
|
ss = self._columns[k]._symbol_set
|
||||||
query = 'UPDATE "%s" SET "%s"=%s WHERE "%s" is NULL' % (self._table, k, ss[0], k)
|
query = 'UPDATE "%s" SET "%s"=%s WHERE "%s" is NULL' % (self._table, k, ss[0], k)
|
||||||
cr.execute(query, (ss[1](default),))
|
cr.execute(query, (ss[1](default),))
|
||||||
|
@ -3176,7 +3176,7 @@ class BaseModel(object):
|
||||||
# and add constraints if needed
|
# and add constraints if needed
|
||||||
if isinstance(f, fields.many2one):
|
if isinstance(f, fields.many2one):
|
||||||
if not self.pool.get(f._obj):
|
if not self.pool.get(f._obj):
|
||||||
raise except_orm('Programming Error', ('There is no reference available for %s') % (f._obj,))
|
raise except_orm('Programming Error', 'There is no reference available for %s' % (f._obj,))
|
||||||
dest_model = self.pool.get(f._obj)
|
dest_model = self.pool.get(f._obj)
|
||||||
ref = dest_model._table
|
ref = dest_model._table
|
||||||
# ir_actions is inherited so foreign key doesn't work on it
|
# ir_actions is inherited so foreign key doesn't work on it
|
||||||
|
@ -3303,7 +3303,7 @@ class BaseModel(object):
|
||||||
# TODO the condition could use fields_get_keys().
|
# TODO the condition could use fields_get_keys().
|
||||||
if f._fields_id not in other._columns.keys():
|
if f._fields_id not in other._columns.keys():
|
||||||
if f._fields_id not in other._inherit_fields.keys():
|
if f._fields_id not in other._inherit_fields.keys():
|
||||||
raise except_orm('Programming Error', ("There is no reference field '%s' found for '%s'") % (f._fields_id, f._obj,))
|
raise except_orm('Programming Error', "There is no reference field '%s' found for '%s'" % (f._fields_id, f._obj,))
|
||||||
|
|
||||||
def _m2m_raise_or_create_relation(self, cr, f):
|
def _m2m_raise_or_create_relation(self, cr, f):
|
||||||
m2m_tbl, col1, col2 = f._sql_names(self)
|
m2m_tbl, col1, col2 = f._sql_names(self)
|
||||||
|
@ -3311,7 +3311,7 @@ class BaseModel(object):
|
||||||
cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (m2m_tbl,))
|
cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (m2m_tbl,))
|
||||||
if not cr.dictfetchall():
|
if not cr.dictfetchall():
|
||||||
if not self.pool.get(f._obj):
|
if not self.pool.get(f._obj):
|
||||||
raise except_orm('Programming Error', ('Many2Many destination model does not exist: `%s`') % (f._obj,))
|
raise except_orm('Programming Error', 'Many2Many destination model does not exist: `%s`' % (f._obj,))
|
||||||
dest_model = self.pool.get(f._obj)
|
dest_model = self.pool.get(f._obj)
|
||||||
ref = dest_model._table
|
ref = dest_model._table
|
||||||
cr.execute('CREATE TABLE "%s" ("%s" INTEGER NOT NULL, "%s" INTEGER NOT NULL, UNIQUE("%s","%s"))' % (m2m_tbl, col1, col2, col1, col2))
|
cr.execute('CREATE TABLE "%s" ("%s" INTEGER NOT NULL, "%s" INTEGER NOT NULL, UNIQUE("%s","%s"))' % (m2m_tbl, col1, col2, col1, col2))
|
||||||
|
@ -4672,7 +4672,7 @@ class BaseModel(object):
|
||||||
new_tables = []
|
new_tables = []
|
||||||
for table in added_tables:
|
for table in added_tables:
|
||||||
# table is just a table name -> switch to the full alias
|
# table is just a table name -> switch to the full alias
|
||||||
if table == '"%s"' % (parent_table):
|
if table == '"%s"' % parent_table:
|
||||||
new_tables.append('"%s" as "%s"' % (parent_table, parent_alias))
|
new_tables.append('"%s" as "%s"' % (parent_table, parent_alias))
|
||||||
# table is already a full statement -> replace reference to the table to its alias, is correct with the way aliases are generated
|
# table is already a full statement -> replace reference to the table to its alias, is correct with the way aliases are generated
|
||||||
else:
|
else:
|
||||||
|
@ -4997,7 +4997,7 @@ class BaseModel(object):
|
||||||
"""
|
"""
|
||||||
if type(ids) in (int, long):
|
if type(ids) in (int, long):
|
||||||
ids = [ids]
|
ids = [ids]
|
||||||
query = 'SELECT id FROM "%s"' % (self._table)
|
query = 'SELECT id FROM "%s"' % self._table
|
||||||
cr.execute(query + "WHERE ID IN %s", (tuple(ids),))
|
cr.execute(query + "WHERE ID IN %s", (tuple(ids),))
|
||||||
return [x[0] for x in cr.fetchall()]
|
return [x[0] for x in cr.fetchall()]
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ class Query(object):
|
||||||
query_from = add_joins_for_table(table_alias, query_from)
|
query_from = add_joins_for_table(table_alias, query_from)
|
||||||
query_from += ','
|
query_from += ','
|
||||||
query_from = query_from[:-1] # drop last comma
|
query_from = query_from[:-1] # drop last comma
|
||||||
return (query_from, " AND ".join(self.where_clause), self.where_clause_params)
|
return query_from, " AND ".join(self.where_clause), self.where_clause_params
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '<osv.Query: "SELECT ... FROM %s WHERE %s" with params: %r>' % self.get_sql()
|
return '<osv.Query: "SELECT ... FROM %s WHERE %s" with params: %r>' % self.get_sql()
|
||||||
|
|
|
@ -273,7 +273,7 @@ class report_custom(report_int):
|
||||||
res = self._create_bars(cr,uid, ids, report, fields, results2, context)
|
res = self._create_bars(cr,uid, ids, report, fields, results2, context)
|
||||||
elif report['type']=='line':
|
elif report['type']=='line':
|
||||||
res = self._create_lines(cr,uid, ids, report, fields, results2, context)
|
res = self._create_lines(cr,uid, ids, report, fields, results2, context)
|
||||||
return (self.obj.get(), 'pdf')
|
return self.obj.get(), 'pdf'
|
||||||
|
|
||||||
def _create_tree(self, uid, ids, report, fields, level, results, context):
|
def _create_tree(self, uid, ids, report, fields, level, results, context):
|
||||||
pageSize=common.pageSize.get(report['print_format'], [210.0,297.0])
|
pageSize=common.pageSize.get(report['print_format'], [210.0,297.0])
|
||||||
|
|
|
@ -52,7 +52,7 @@ def _1000_to_text(chiffre):
|
||||||
d2 = chiffre/100
|
d2 = chiffre/100
|
||||||
if d2>0 and d:
|
if d2>0 and d:
|
||||||
return centaine[d2]+' '+d
|
return centaine[d2]+' '+d
|
||||||
elif d2>1 and not(d):
|
elif d2>1 and not d:
|
||||||
return centaine[d2]+'s'
|
return centaine[d2]+'s'
|
||||||
else:
|
else:
|
||||||
return centaine[d2] or d
|
return centaine[d2] or d
|
||||||
|
|
|
@ -85,7 +85,7 @@ class report_rml(report_int):
|
||||||
xml = tools.ustr(xml).encode('utf8')
|
xml = tools.ustr(xml).encode('utf8')
|
||||||
report_type = datas.get('report_type', 'pdf')
|
report_type = datas.get('report_type', 'pdf')
|
||||||
if report_type == 'raw':
|
if report_type == 'raw':
|
||||||
return (xml,report_type)
|
return xml, report_type
|
||||||
rml = self.create_rml(cr, xml, uid, context)
|
rml = self.create_rml(cr, xml, uid, context)
|
||||||
pool = pooler.get_pool(cr.dbname)
|
pool = pooler.get_pool(cr.dbname)
|
||||||
ir_actions_report_xml_obj = pool.get('ir.actions.report.xml')
|
ir_actions_report_xml_obj = pool.get('ir.actions.report.xml')
|
||||||
|
@ -93,7 +93,7 @@ class report_rml(report_int):
|
||||||
self.title = report_xml_ids and ir_actions_report_xml_obj.browse(cr,uid,report_xml_ids)[0].name or 'OpenERP Report'
|
self.title = report_xml_ids and ir_actions_report_xml_obj.browse(cr,uid,report_xml_ids)[0].name or 'OpenERP Report'
|
||||||
create_doc = self.generators[report_type]
|
create_doc = self.generators[report_type]
|
||||||
pdf = create_doc(rml, title=self.title)
|
pdf = create_doc(rml, title=self.title)
|
||||||
return (pdf, report_type)
|
return pdf, report_type
|
||||||
|
|
||||||
def create_xml(self, cr, uid, ids, datas, context=None):
|
def create_xml(self, cr, uid, ids, datas, context=None):
|
||||||
if not context:
|
if not context:
|
||||||
|
|
|
@ -65,7 +65,7 @@ class report_printscreen_list(report_int):
|
||||||
fields_order = self._parse_string(result['arch'])
|
fields_order = self._parse_string(result['arch'])
|
||||||
rows = model.read(cr, uid, datas['ids'], result['fields'].keys() )
|
rows = model.read(cr, uid, datas['ids'], result['fields'].keys() )
|
||||||
self._create_table(uid, datas['ids'], result['fields'], fields_order, rows, context, model._description)
|
self._create_table(uid, datas['ids'], result['fields'], fields_order, rows, context, model._description)
|
||||||
return (self.obj.get(), 'pdf')
|
return self.obj.get(), 'pdf'
|
||||||
|
|
||||||
|
|
||||||
def _create_table(self, uid, ids, fields, fields_order, results, context, title=''):
|
def _create_table(self, uid, ids, fields, fields_order, results, context, title=''):
|
||||||
|
|
|
@ -115,7 +115,7 @@ class report_printscreen_list(report_int):
|
||||||
rows_new += [elem for elem in rows if elem['id'] == id]
|
rows_new += [elem for elem in rows if elem['id'] == id]
|
||||||
rows = rows_new
|
rows = rows_new
|
||||||
res = self._create_table(uid, datas['ids'], result['fields'], fields_order, rows, context, model_desc)
|
res = self._create_table(uid, datas['ids'], result['fields'], fields_order, rows, context, model_desc)
|
||||||
return (self.obj.get(), 'pdf')
|
return self.obj.get(), 'pdf'
|
||||||
|
|
||||||
|
|
||||||
def _create_table(self, uid, ids, fields, fields_order, results, context, title=''):
|
def _create_table(self, uid, ids, fields, fields_order, results, context, title=''):
|
||||||
|
|
|
@ -299,7 +299,7 @@ class PdfFileWriter(object):
|
||||||
trailer.writeToStream(stream, None)
|
trailer.writeToStream(stream, None)
|
||||||
|
|
||||||
# eof
|
# eof
|
||||||
stream.write("\nstartxref\n%s\n%%%%EOF\n" % (xref_location))
|
stream.write("\nstartxref\n%s\n%%%%EOF\n" % xref_location)
|
||||||
|
|
||||||
def _sweepIndirectReferences(self, externMap, data):
|
def _sweepIndirectReferences(self, externMap, data):
|
||||||
if isinstance(data, DictionaryObject):
|
if isinstance(data, DictionaryObject):
|
||||||
|
|
|
@ -391,7 +391,7 @@ class _rml_doc(object):
|
||||||
list_story.append(story_text)
|
list_story.append(story_text)
|
||||||
del f
|
del f
|
||||||
if template.data:
|
if template.data:
|
||||||
tag = '''<img src = '%s' width=80 height=72/>'''%(template.data)
|
tag = '''<img src = '%s' width=80 height=72/>'''% template.data
|
||||||
else:
|
else:
|
||||||
tag = ''
|
tag = ''
|
||||||
self.result +='''
|
self.result +='''
|
||||||
|
|
|
@ -35,7 +35,7 @@ def get(col_str):
|
||||||
return allcols[col_str]
|
return allcols[col_str]
|
||||||
res = regex_t.search(col_str, 0)
|
res = regex_t.search(col_str, 0)
|
||||||
if res:
|
if res:
|
||||||
return (float(res.group(1)),float(res.group(2)),float(res.group(3)))
|
return float(res.group(1)), float(res.group(2)), float(res.group(3))
|
||||||
res = regex_h.search(col_str, 0)
|
res = regex_h.search(col_str, 0)
|
||||||
if res:
|
if res:
|
||||||
return tuple([ float(int(res.group(i),16))/255 for i in range(1,4)])
|
return tuple([ float(int(res.group(i),16))/255 for i in range(1,4)])
|
||||||
|
|
|
@ -123,7 +123,7 @@ class PageCount(platypus.Flowable):
|
||||||
self.story_count = story_count
|
self.story_count = story_count
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
self.canv.beginForm("pageCount%d" % (self.story_count))
|
self.canv.beginForm("pageCount%d" % self.story_count)
|
||||||
self.canv.setFont("Helvetica", utils.unit_get(str(8)))
|
self.canv.setFont("Helvetica", utils.unit_get(str(8)))
|
||||||
self.canv.drawString(0, 0, str(self.canv.getPageNumber()))
|
self.canv.drawString(0, 0, str(self.canv.getPageNumber()))
|
||||||
self.canv.endForm()
|
self.canv.endForm()
|
||||||
|
@ -268,18 +268,18 @@ class _rml_doc(object):
|
||||||
|
|
||||||
if fontname not in pdfmetrics._fonts:
|
if fontname not in pdfmetrics._fonts:
|
||||||
pdfmetrics.registerFont(TTFont(fontname, filename))
|
pdfmetrics.registerFont(TTFont(fontname, filename))
|
||||||
if (mode == 'all'):
|
if mode == 'all':
|
||||||
addMapping(face, 0, 0, fontname) #normal
|
addMapping(face, 0, 0, fontname) #normal
|
||||||
addMapping(face, 0, 1, fontname) #italic
|
addMapping(face, 0, 1, fontname) #italic
|
||||||
addMapping(face, 1, 0, fontname) #bold
|
addMapping(face, 1, 0, fontname) #bold
|
||||||
addMapping(face, 1, 1, fontname) #italic and bold
|
addMapping(face, 1, 1, fontname) #italic and bold
|
||||||
elif (mode== 'normal') or (mode == 'regular'):
|
elif (mode== 'normal') or (mode == 'regular'):
|
||||||
addMapping(face, 0, 0, fontname) #normal
|
addMapping(face, 0, 0, fontname) #normal
|
||||||
elif (mode == 'italic'):
|
elif mode == 'italic':
|
||||||
addMapping(face, 0, 1, fontname) #italic
|
addMapping(face, 0, 1, fontname) #italic
|
||||||
elif (mode == 'bold'):
|
elif mode == 'bold':
|
||||||
addMapping(face, 1, 0, fontname) #bold
|
addMapping(face, 1, 0, fontname) #bold
|
||||||
elif (mode == 'bolditalic'):
|
elif mode == 'bolditalic':
|
||||||
addMapping(face, 1, 1, fontname) #italic and bold
|
addMapping(face, 1, 1, fontname) #italic and bold
|
||||||
|
|
||||||
def _textual_image(self, node):
|
def _textual_image(self, node):
|
||||||
|
@ -602,7 +602,7 @@ class _rml_Illustration(platypus.flowables.Flowable):
|
||||||
self.height = utils.unit_get(node.get('height'))
|
self.height = utils.unit_get(node.get('height'))
|
||||||
self.self2 = self2
|
self.self2 = self2
|
||||||
def wrap(self, *args):
|
def wrap(self, *args):
|
||||||
return (self.width, self.height)
|
return self.width, self.height
|
||||||
def draw(self):
|
def draw(self):
|
||||||
drw = _rml_draw(self.localcontext ,self.node,self.styles, images=self.self2.images, path=self.self2.path, title=self.self2.title)
|
drw = _rml_draw(self.localcontext ,self.node,self.styles, images=self.self2.images, path=self.self2.path, title=self.self2.title)
|
||||||
drw.render(self.canv, None)
|
drw.render(self.canv, None)
|
||||||
|
|
|
@ -107,11 +107,11 @@ class textbox(object):
|
||||||
def haplines(self,arr,offset,cc= ''):
|
def haplines(self,arr,offset,cc= ''):
|
||||||
""" Horizontaly append lines
|
""" Horizontaly append lines
|
||||||
"""
|
"""
|
||||||
while (len(self.lines) < len(arr)):
|
while len(self.lines) < len(arr):
|
||||||
self.lines.append("")
|
self.lines.append("")
|
||||||
|
|
||||||
for i in range(len(self.lines)):
|
for i in range(len(self.lines)):
|
||||||
while (len(self.lines[i]) < offset):
|
while len(self.lines[i]) < offset:
|
||||||
self.lines[i] += " "
|
self.lines[i] += " "
|
||||||
for i in range(len(arr)):
|
for i in range(len(arr)):
|
||||||
self.lines[i] += cc +arr[i]
|
self.lines[i] += cc +arr[i]
|
||||||
|
|
|
@ -441,7 +441,7 @@ class report_sxw(report_rml, preprocess.report):
|
||||||
raise NotImplementedError(_('Unknown report type: %s') % report_type)
|
raise NotImplementedError(_('Unknown report type: %s') % report_type)
|
||||||
fnct_ret = fnct(cr, uid, ids, data, report_xml, context)
|
fnct_ret = fnct(cr, uid, ids, data, report_xml, context)
|
||||||
if not fnct_ret:
|
if not fnct_ret:
|
||||||
return (False,False)
|
return False, False
|
||||||
return fnct_ret
|
return fnct_ret
|
||||||
|
|
||||||
def create_source_odt(self, cr, uid, ids, data, report_xml, context=None):
|
def create_source_odt(self, cr, uid, ids, data, report_xml, context=None):
|
||||||
|
@ -531,7 +531,7 @@ class report_sxw(report_rml, preprocess.report):
|
||||||
logo = base64.decodestring(rml_parser.logo)
|
logo = base64.decodestring(rml_parser.logo)
|
||||||
create_doc = self.generators[report_xml.report_type]
|
create_doc = self.generators[report_xml.report_type]
|
||||||
pdf = create_doc(etree.tostring(processed_rml),rml_parser.localcontext,logo,title.encode('utf8'))
|
pdf = create_doc(etree.tostring(processed_rml),rml_parser.localcontext,logo,title.encode('utf8'))
|
||||||
return (pdf, report_xml.report_type)
|
return pdf, report_xml.report_type
|
||||||
|
|
||||||
def create_single_odt(self, cr, uid, ids, data, report_xml, context=None):
|
def create_single_odt(self, cr, uid, ids, data, report_xml, context=None):
|
||||||
if not context:
|
if not context:
|
||||||
|
@ -644,7 +644,7 @@ class report_sxw(report_rml, preprocess.report):
|
||||||
sxw_z.close()
|
sxw_z.close()
|
||||||
final_op = sxw_io.getvalue()
|
final_op = sxw_io.getvalue()
|
||||||
sxw_io.close()
|
sxw_io.close()
|
||||||
return (final_op, mime_type)
|
return final_op, mime_type
|
||||||
|
|
||||||
def create_single_html2html(self, cr, uid, ids, data, report_xml, context=None):
|
def create_single_html2html(self, cr, uid, ids, data, report_xml, context=None):
|
||||||
if not context:
|
if not context:
|
||||||
|
@ -666,7 +666,7 @@ class report_sxw(report_rml, preprocess.report):
|
||||||
create_doc = self.generators['html2html']
|
create_doc = self.generators['html2html']
|
||||||
html = etree.tostring(create_doc(html_dom, html_parser.localcontext))
|
html = etree.tostring(create_doc(html_dom, html_parser.localcontext))
|
||||||
|
|
||||||
return (html.replace('&','&').replace('<', '<').replace('>', '>').replace('</br>',''), report_type)
|
return html.replace('&','&').replace('<', '<').replace('>', '>').replace('</br>',''), report_type
|
||||||
|
|
||||||
def create_single_mako2html(self, cr, uid, ids, data, report_xml, context=None):
|
def create_single_mako2html(self, cr, uid, ids, data, report_xml, context=None):
|
||||||
mako_html = report_xml.report_rml_content
|
mako_html = report_xml.report_rml_content
|
||||||
|
@ -675,7 +675,7 @@ class report_sxw(report_rml, preprocess.report):
|
||||||
html_parser.set_context(objs, data, ids, 'html')
|
html_parser.set_context(objs, data, ids, 'html')
|
||||||
create_doc = self.generators['makohtml2html']
|
create_doc = self.generators['makohtml2html']
|
||||||
html = create_doc(mako_html,html_parser.localcontext)
|
html = create_doc(mako_html,html_parser.localcontext)
|
||||||
return (html,'html')
|
return html,'html'
|
||||||
|
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -139,7 +139,7 @@ class OpenERPAuthProvider(AuthProvider):
|
||||||
uid = security.login(db,user,passwd)
|
uid = security.login(db,user,passwd)
|
||||||
if uid is False:
|
if uid is False:
|
||||||
return False
|
return False
|
||||||
return (user, passwd, db, uid)
|
return user, passwd, db, uid
|
||||||
except Exception,e:
|
except Exception,e:
|
||||||
_logger.debug("Fail auth: %s" % e )
|
_logger.debug("Fail auth: %s" % e )
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -172,13 +172,13 @@ class db(netsvc.ExportService):
|
||||||
def exp_get_progress(self, id):
|
def exp_get_progress(self, id):
|
||||||
if self.actions[id]['thread'].isAlive():
|
if self.actions[id]['thread'].isAlive():
|
||||||
# return openerp.modules.init_progress[db_name]
|
# return openerp.modules.init_progress[db_name]
|
||||||
return (min(self.actions[id].get('progress', 0),0.95), [])
|
return min(self.actions[id].get('progress', 0),0.95), []
|
||||||
else:
|
else:
|
||||||
clean = self.actions[id]['clean']
|
clean = self.actions[id]['clean']
|
||||||
if clean:
|
if clean:
|
||||||
users = self.actions[id]['users']
|
users = self.actions[id]['users']
|
||||||
self.actions.pop(id)
|
self.actions.pop(id)
|
||||||
return (1.0, users)
|
return 1.0, users
|
||||||
else:
|
else:
|
||||||
e = self.actions[id]['exception'] # TODO this seems wrong: actions[id]['traceback'] is set, but not 'exception'.
|
e = self.actions[id]['exception'] # TODO this seems wrong: actions[id]['traceback'] is set, but not 'exception'.
|
||||||
self.actions.pop(id)
|
self.actions.pop(id)
|
||||||
|
@ -543,7 +543,7 @@ GNU Public Licence.
|
||||||
if os.name == 'posix':
|
if os.name == 'posix':
|
||||||
if platform.system() == 'Linux':
|
if platform.system() == 'Linux':
|
||||||
lsbinfo = os.popen('lsb_release -a').read()
|
lsbinfo = os.popen('lsb_release -a').read()
|
||||||
environment += '%s'%(lsbinfo)
|
environment += '%s'% lsbinfo
|
||||||
else:
|
else:
|
||||||
environment += 'Your System is not lsb compliant\n'
|
environment += 'Your System is not lsb compliant\n'
|
||||||
environment += 'Operating System Release : %s\n' \
|
environment += 'Operating System Release : %s\n' \
|
||||||
|
|
|
@ -226,11 +226,11 @@ class Cursor(object):
|
||||||
params = params or None
|
params = params or None
|
||||||
res = self._obj.execute(query, params)
|
res = self._obj.execute(query, params)
|
||||||
except psycopg2.ProgrammingError, pe:
|
except psycopg2.ProgrammingError, pe:
|
||||||
if (self._default_log_exceptions if log_exceptions is None else log_exceptions):
|
if self._default_log_exceptions if log_exceptions is None else log_exceptions:
|
||||||
_logger.error("Programming error: %s, in query %s", pe, query)
|
_logger.error("Programming error: %s, in query %s", pe, query)
|
||||||
raise
|
raise
|
||||||
except Exception:
|
except Exception:
|
||||||
if (self._default_log_exceptions if log_exceptions is None else log_exceptions):
|
if self._default_log_exceptions if log_exceptions is None else log_exceptions:
|
||||||
_logger.exception("bad query: %s", self._obj.query or query)
|
_logger.exception("bad query: %s", self._obj.query or query)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
|
@ -352,7 +352,7 @@ class configmanager(object):
|
||||||
# Check if the config file exists (-c used, but not -s)
|
# Check if the config file exists (-c used, but not -s)
|
||||||
die(not opt.save and opt.config and not os.path.exists(opt.config),
|
die(not opt.save and opt.config and not os.path.exists(opt.config),
|
||||||
"The config file '%s' selected with -c/--config doesn't exist, "\
|
"The config file '%s' selected with -c/--config doesn't exist, "\
|
||||||
"use -s/--save if you want to generate it"%(opt.config))
|
"use -s/--save if you want to generate it"% opt.config)
|
||||||
|
|
||||||
# place/search the config file on Win32 near the server installation
|
# place/search the config file on Win32 near the server installation
|
||||||
# (../etc from the server)
|
# (../etc from the server)
|
||||||
|
|
|
@ -662,7 +662,7 @@ form: module.record_id""" % (xml_id,)
|
||||||
if rec.get('action') and pid:
|
if rec.get('action') and pid:
|
||||||
action = "ir.actions.%s,%d" % (a_type, a_id)
|
action = "ir.actions.%s,%d" % (a_type, a_id)
|
||||||
self.pool.get('ir.model.data').ir_set(cr, self.uid, 'action', 'tree_but_open', 'Menuitem', [('ir.ui.menu', int(pid))], action, True, True, xml_id=rec_id)
|
self.pool.get('ir.model.data').ir_set(cr, self.uid, 'action', 'tree_but_open', 'Menuitem', [('ir.ui.menu', int(pid))], action, True, True, xml_id=rec_id)
|
||||||
return ('ir.ui.menu', pid)
|
return 'ir.ui.menu', pid
|
||||||
|
|
||||||
def _assert_equals(self, f1, f2, prec=4):
|
def _assert_equals(self, f1, f2, prec=4):
|
||||||
return not round(f1 - f2, prec)
|
return not round(f1 - f2, prec)
|
||||||
|
|
|
@ -45,7 +45,7 @@ def frame_codeinfo(fframe, back=0):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not fframe:
|
if not fframe:
|
||||||
return ("<unknown>", '')
|
return "<unknown>", ''
|
||||||
for i in range(back):
|
for i in range(back):
|
||||||
fframe = fframe.f_back
|
fframe = fframe.f_back
|
||||||
try:
|
try:
|
||||||
|
@ -53,8 +53,8 @@ def frame_codeinfo(fframe, back=0):
|
||||||
except TypeError:
|
except TypeError:
|
||||||
fname = '<builtin>'
|
fname = '<builtin>'
|
||||||
lineno = fframe.f_lineno or ''
|
lineno = fframe.f_lineno or ''
|
||||||
return (fname, lineno)
|
return fname, lineno
|
||||||
except Exception:
|
except Exception:
|
||||||
return ("<unknown>", '')
|
return "<unknown>", ''
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -70,7 +70,7 @@ class graph(object):
|
||||||
for edge in list_edge:
|
for edge in list_edge:
|
||||||
if ((self.reachable_nodes.__contains__(edge[0]) and edge[1] not in self.reachable_nodes) or
|
if ((self.reachable_nodes.__contains__(edge[0]) and edge[1] not in self.reachable_nodes) or
|
||||||
(self.reachable_nodes.__contains__(edge[1]) and edge[0] not in self.reachable_nodes)):
|
(self.reachable_nodes.__contains__(edge[1]) and edge[0] not in self.reachable_nodes)):
|
||||||
if(slack>self.edge_wt[edge]-1):
|
if slack > self.edge_wt[edge]-1:
|
||||||
slack = self.edge_wt[edge]-1
|
slack = self.edge_wt[edge]-1
|
||||||
new_edge = edge
|
new_edge = edge
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ class graph(object):
|
||||||
if source_node in self.head_nodes:
|
if source_node in self.head_nodes:
|
||||||
for dest_node in self.transitions[source_node]:
|
for dest_node in self.transitions[source_node]:
|
||||||
if dest_node not in self.head_nodes:
|
if dest_node not in self.head_nodes:
|
||||||
if(slack>(self.edge_wt[edge]-1)):
|
if slack>(self.edge_wt[edge]-1):
|
||||||
slack = self.edge_wt[edge]-1
|
slack = self.edge_wt[edge]-1
|
||||||
new_edge = (source_node, dest_node)
|
new_edge = (source_node, dest_node)
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ class graph(object):
|
||||||
|
|
||||||
least_rank = min(map(lambda x: x['x'], self.result.values()))
|
least_rank = min(map(lambda x: x['x'], self.result.values()))
|
||||||
|
|
||||||
if(least_rank!=0):
|
if least_rank!=0:
|
||||||
for node in self.result:
|
for node in self.result:
|
||||||
self.result[node]['x']-=least_rank
|
self.result[node]['x']-=least_rank
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ class graph(object):
|
||||||
|
|
||||||
if pre_level_nodes:
|
if pre_level_nodes:
|
||||||
for src in pre_level_nodes:
|
for src in pre_level_nodes:
|
||||||
if (self.transitions.get(src) and self.transitions[src].__contains__(node)):
|
if self.transitions.get(src) and self.transitions[src].__contains__(node):
|
||||||
adj_nodes.append(self.result[src]['y'])
|
adj_nodes.append(self.result[src]['y'])
|
||||||
|
|
||||||
return adj_nodes
|
return adj_nodes
|
||||||
|
@ -455,7 +455,7 @@ class graph(object):
|
||||||
mid_node = l[no/2]
|
mid_node = l[no/2]
|
||||||
self.result[mid_node]['y'] = mid_pos
|
self.result[mid_node]['y'] = mid_pos
|
||||||
|
|
||||||
if self.transitions.get((mid_node), False):
|
if self.transitions.get(mid_node, False):
|
||||||
if last:
|
if last:
|
||||||
self.result[mid_node]['y'] = last + len(self.transitions[mid_node])/2 + 1
|
self.result[mid_node]['y'] = last + len(self.transitions[mid_node])/2 + 1
|
||||||
if node!=mid_node:
|
if node!=mid_node:
|
||||||
|
@ -494,7 +494,7 @@ class graph(object):
|
||||||
if max_level%2:
|
if max_level%2:
|
||||||
self.result[self.start]['y'] = (max_level+1)/2 + self.max_order + (self.max_order and 1)
|
self.result[self.start]['y'] = (max_level+1)/2 + self.max_order + (self.max_order and 1)
|
||||||
else:
|
else:
|
||||||
self.result[self.start]['y'] = (max_level)/2 + self.max_order + (self.max_order and 1)
|
self.result[self.start]['y'] = max_level /2 + self.max_order + (self.max_order and 1)
|
||||||
|
|
||||||
self.graph_order()
|
self.graph_order()
|
||||||
|
|
||||||
|
@ -716,7 +716,7 @@ class graph(object):
|
||||||
#for flat edges ie. source an destination nodes are on the same rank
|
#for flat edges ie. source an destination nodes are on the same rank
|
||||||
for src in self.transitions:
|
for src in self.transitions:
|
||||||
for des in self.transitions[src]:
|
for des in self.transitions[src]:
|
||||||
if (self.result[des]['x'] - self.result[src]['x'] == 0):
|
if self.result[des]['x'] - self.result[src]['x'] == 0:
|
||||||
self.result[src]['x'] += 0.08
|
self.result[src]['x'] += 0.08
|
||||||
self.result[des]['x'] -= 0.08
|
self.result[des]['x'] -= 0.08
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ def exec_pg_command_pipe(name, *args):
|
||||||
pop = subprocess.Popen((prog,) + args, bufsize= -1,
|
pop = subprocess.Popen((prog,) + args, bufsize= -1,
|
||||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||||
close_fds=(os.name=="posix"))
|
close_fds=(os.name=="posix"))
|
||||||
return (pop.stdin, pop.stdout)
|
return pop.stdin, pop.stdout
|
||||||
|
|
||||||
def exec_command_pipe(name, *args):
|
def exec_command_pipe(name, *args):
|
||||||
prog = find_in_path(name)
|
prog = find_in_path(name)
|
||||||
|
@ -103,7 +103,7 @@ def exec_command_pipe(name, *args):
|
||||||
pop = subprocess.Popen((prog,) + args, bufsize= -1,
|
pop = subprocess.Popen((prog,) + args, bufsize= -1,
|
||||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||||
close_fds=(os.name=="posix"))
|
close_fds=(os.name=="posix"))
|
||||||
return (pop.stdin, pop.stdout)
|
return pop.stdin, pop.stdout
|
||||||
|
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
# File paths
|
# File paths
|
||||||
|
@ -181,7 +181,7 @@ def _fileopen(path, mode, basedir, pathinfo, basename=None):
|
||||||
if os.path.isfile(name):
|
if os.path.isfile(name):
|
||||||
fo = open(name, mode)
|
fo = open(name, mode)
|
||||||
if pathinfo:
|
if pathinfo:
|
||||||
return (fo, name)
|
return fo, name
|
||||||
return fo
|
return fo
|
||||||
|
|
||||||
# Support for loading modules in zipped form.
|
# Support for loading modules in zipped form.
|
||||||
|
@ -208,7 +208,7 @@ def _fileopen(path, mode, basedir, pathinfo, basename=None):
|
||||||
os.sep, '/')))
|
os.sep, '/')))
|
||||||
fo.seek(0)
|
fo.seek(0)
|
||||||
if pathinfo:
|
if pathinfo:
|
||||||
return (fo, name)
|
return fo, name
|
||||||
return fo
|
return fo
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
@ -725,7 +725,7 @@ def get_win32_timezone():
|
||||||
@return the standard name of the current win32 timezone, or False if it cannot be found.
|
@return the standard name of the current win32 timezone, or False if it cannot be found.
|
||||||
"""
|
"""
|
||||||
res = False
|
res = False
|
||||||
if (sys.platform == "win32"):
|
if sys.platform == "win32":
|
||||||
try:
|
try:
|
||||||
import _winreg
|
import _winreg
|
||||||
hklm = _winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE)
|
hklm = _winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE)
|
||||||
|
@ -756,7 +756,7 @@ def detect_server_timezone():
|
||||||
(time.tzname[0], 'time.tzname'),
|
(time.tzname[0], 'time.tzname'),
|
||||||
(os.environ.get('TZ',False),'TZ environment variable'), ]
|
(os.environ.get('TZ',False),'TZ environment variable'), ]
|
||||||
# Option 4: OS-specific: /etc/timezone on Unix
|
# Option 4: OS-specific: /etc/timezone on Unix
|
||||||
if (os.path.exists("/etc/timezone")):
|
if os.path.exists("/etc/timezone"):
|
||||||
tz_value = False
|
tz_value = False
|
||||||
try:
|
try:
|
||||||
f = open("/etc/timezone")
|
f = open("/etc/timezone")
|
||||||
|
@ -767,7 +767,7 @@ def detect_server_timezone():
|
||||||
f.close()
|
f.close()
|
||||||
sources.append((tz_value,"/etc/timezone file"))
|
sources.append((tz_value,"/etc/timezone file"))
|
||||||
# Option 5: timezone info from registry on Win32
|
# Option 5: timezone info from registry on Win32
|
||||||
if (sys.platform == "win32"):
|
if sys.platform == "win32":
|
||||||
# Timezone info is stored in windows registry.
|
# Timezone info is stored in windows registry.
|
||||||
# However this is not likely to work very well as the standard name
|
# However this is not likely to work very well as the standard name
|
||||||
# of timezones in windows is rarely something that is known to pytz.
|
# of timezones in windows is rarely something that is known to pytz.
|
||||||
|
|
|
@ -288,7 +288,7 @@ class TinyPoFile(object):
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
def cur_line(self):
|
def cur_line(self):
|
||||||
return (self.lines_count - len(self.lines))
|
return self.lines_count - len(self.lines)
|
||||||
|
|
||||||
def next(self):
|
def next(self):
|
||||||
trans_type = name = res_id = source = trad = None
|
trans_type = name = res_id = source = trad = None
|
||||||
|
@ -301,7 +301,7 @@ class TinyPoFile(object):
|
||||||
targets = []
|
targets = []
|
||||||
line = None
|
line = None
|
||||||
fuzzy = False
|
fuzzy = False
|
||||||
while (not line):
|
while not line:
|
||||||
if 0 == len(self.lines):
|
if 0 == len(self.lines):
|
||||||
raise StopIteration()
|
raise StopIteration()
|
||||||
line = self.lines.pop(0).strip()
|
line = self.lines.pop(0).strip()
|
||||||
|
@ -861,7 +861,7 @@ def trans_generate(lang, modules, cr):
|
||||||
frelativepath = fabsolutepath[len(path):]
|
frelativepath = fabsolutepath[len(path):]
|
||||||
display_path = "addons%s" % frelativepath
|
display_path = "addons%s" % frelativepath
|
||||||
module = get_module_from_path(fabsolutepath, mod_paths=mod_paths)
|
module = get_module_from_path(fabsolutepath, mod_paths=mod_paths)
|
||||||
if (('all' in modules) or (module in modules)) and module in installed_modules:
|
if ('all' in modules or module in modules) and module in installed_modules:
|
||||||
return module, fabsolutepath, frelativepath, display_path
|
return module, fabsolutepath, frelativepath, display_path
|
||||||
return None, None, None, None
|
return None, None, None, None
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ def _execute(cr, workitem, activity, ident, stack):
|
||||||
_state_set(cr, workitem, activity, 'running', ident)
|
_state_set(cr, workitem, activity, 'running', ident)
|
||||||
if activity.get('action', False):
|
if activity.get('action', False):
|
||||||
id_new = wkf_expr.execute(cr, ident, workitem, activity)
|
id_new = wkf_expr.execute(cr, ident, workitem, activity)
|
||||||
if not (id_new):
|
if not id_new:
|
||||||
cr.execute('delete from wkf_workitem where id=%s', (workitem['id'],))
|
cr.execute('delete from wkf_workitem where id=%s', (workitem['id'],))
|
||||||
return False
|
return False
|
||||||
assert type(id_new)==type(1) or type(id_new)==type(1L), 'Wrong return value: '+str(id_new)+' '+str(type(id_new))
|
assert type(id_new)==type(1) or type(id_new)==type(1L), 'Wrong return value: '+str(id_new)+' '+str(type(id_new))
|
||||||
|
|
Loading…
Reference in New Issue