Fix flake8

This commit is contained in:
Cédric Krier
2013-02-17 15:30:45 +01:00
parent 0e005b31fc
commit 5d3a3dc18c
3 changed files with 50 additions and 49 deletions
+38 -38
View File
@@ -130,24 +130,24 @@ class Account(ModelSQL, ModelView):
id2account[account.id] = account
line_query = Line.query_get()
cursor.execute('SELECT a.id, ' \
'SUM((COALESCE(l.debit, 0) - COALESCE(l.credit, 0))), ' \
'c.currency ' \
'FROM analytic_account_account a ' \
'LEFT JOIN analytic_account_line l ' \
'ON (a.id = l.account) ' \
'LEFT JOIN account_move_line ml ' \
'ON (ml.id = l.move_line) ' \
'LEFT JOIN account_account aa ' \
'ON (aa.id = ml.account) ' \
'LEFT JOIN company_company c ' \
'ON (c.id = aa.company) ' \
'WHERE a.type != \'view\' ' \
'AND a.id IN (' + \
','.join(('%s',) * len(all_ids)) + ') ' \
'AND ' + line_query + ' ' \
'AND a.active ' \
'GROUP BY a.id, c.currency', all_ids)
cursor.execute('SELECT a.id, '
'SUM((COALESCE(l.debit, 0) - COALESCE(l.credit, 0))), '
'c.currency '
'FROM analytic_account_account a '
'LEFT JOIN analytic_account_line l '
'ON (a.id = l.account) '
'LEFT JOIN account_move_line ml '
'ON (ml.id = l.move_line) '
'LEFT JOIN account_account aa '
'ON (aa.id = ml.account) '
'LEFT JOIN company_company c '
'ON (c.id = aa.company) '
'WHERE a.type != \'view\' '
'AND a.id IN (' +
','.join(('%s',) * len(all_ids)) + ') '
'AND ' + line_query + ' '
'AND a.active '
'GROUP BY a.id, c.currency', all_ids)
account_sum = {}
id2currency = {}
for account_id, sum, currency_id in cursor.fetchall():
@@ -199,24 +199,24 @@ class Account(ModelSQL, ModelView):
id2account[account.id] = account
line_query = Line.query_get()
cursor.execute('SELECT a.id, ' \
'SUM(COALESCE(l.' + name + ', 0)), ' \
'c.currency ' \
'FROM analytic_account_account a ' \
'LEFT JOIN analytic_account_line l ' \
'ON (a.id = l.account) ' \
'LEFT JOIN account_move_line ml ' \
'ON (ml.id = l.move_line) ' \
'LEFT JOIN account_account aa ' \
'ON (aa.id = ml.account) ' \
'LEFT JOIN company_company c ' \
'ON (c.id = aa.company) ' \
'WHERE a.type != \'view\' ' \
'AND a.id IN (' + \
','.join(('%s',) * len(ids)) + ') ' \
'AND ' + line_query + ' ' \
'AND a.active ' \
'GROUP BY a.id, c.currency', ids)
cursor.execute('SELECT a.id, '
'SUM(COALESCE(l.' + name + ', 0)), '
'c.currency '
'FROM analytic_account_account a '
'LEFT JOIN analytic_account_line l '
'ON (a.id = l.account) '
'LEFT JOIN account_move_line ml '
'ON (ml.id = l.move_line) '
'LEFT JOIN account_account aa '
'ON (aa.id = ml.account) '
'LEFT JOIN company_company c '
'ON (c.id = aa.company) '
'WHERE a.type != \'view\' '
'AND a.id IN (' +
','.join(('%s',) * len(ids)) + ') '
'AND ' + line_query + ' '
'AND a.active '
'GROUP BY a.id, c.currency', ids)
id2currency = {}
for account_id, sum, currency_id in cursor.fetchall():
@@ -338,8 +338,8 @@ class AccountSelection(ModelSQL, ModelView):
('check_root', 'root_account'),
]
cls._error_messages.update({
'root_account': 'Can not have many accounts with the same ' \
'root or a missing mandatory root account!',
'root_account': ('Can not have many accounts with the same '
'root or a missing mandatory root account!'),
})
@classmethod
+8 -7
View File
@@ -47,9 +47,10 @@ class Line(ModelSQL, ModelView):
('check_account', 'line_on_view_inactive_account'),
]
cls._error_messages.update({
'line_on_view_inactive_account': 'You can not create move line\n' \
'on view/inactive account!',
})
'line_on_view_inactive_account': (
'You can not create move line\n'
'on view/inactive account!'),
})
cls._order.insert(0, ('date', 'ASC'))
@classmethod
@@ -97,13 +98,13 @@ class Line(ModelSQL, ModelView):
if Transaction().context.get('start_date'):
# Check start_date
time.strptime(str(Transaction().context['start_date']), '%Y-%m-%d')
res += ' AND ' + obj + '.date >= date(\'' + \
str(Transaction().context['start_date']) + '\')'
res += (' AND ' + obj + '.date >= date(\''
+ str(Transaction().context['start_date']) + '\')')
if Transaction().context.get('end_date'):
# Check end_date
time.strptime(str(Transaction().context['end_date']), '%Y-%m-%d')
res += ' AND ' + obj + '.date <= date(\'' + \
str(Transaction().context['end_date']) + '\')'
res += (' AND ' + obj + '.date <= date(\''
+ str(Transaction().context['end_date']) + '\')')
return res
def check_account(self):
+4 -4
View File
@@ -36,16 +36,16 @@ setup(name='trytond_analytic_account',
long_description=read('README'),
author='Tryton',
url='http://www.tryton.org/',
download_url="http://downloads.tryton.org/" + \
info.get('version', '0.0.1').rsplit('.', 1)[0] + '/',
download_url=("http://downloads.tryton.org/" +
info.get('version', '0.0.1').rsplit('.', 1)[0] + '/'),
package_dir={'trytond.modules.analytic_account': '.'},
packages=[
'trytond.modules.analytic_account',
'trytond.modules.analytic_account.tests',
],
package_data={
'trytond.modules.analytic_account': info.get('xml', []) \
+ ['tryton.cfg', 'locale/*.po'],
'trytond.modules.analytic_account': (info.get('xml', [])
+ ['tryton.cfg', 'locale/*.po']),
},
classifiers=[
'Development Status :: 5 - Production/Stable',