From 2152913bf1c6bdeda5d5b9ef297075560597913f Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Tue, 3 Mar 2015 15:21:39 +0100 Subject: [PATCH] fix travis (flake8) --- account_asset_management/account_asset.py | 12 ++++++++---- .../wizard/account_asset_remove.py | 5 +++-- account_chart_update/wizard/wizard_chart_update.py | 6 +++--- account_credit_control/run.py | 3 ++- account_renumber/test/create_moves.py | 3 ++- currency_rate_date_check/currency_rate_date_check.py | 6 ++++-- l10n_fr_siret/partner.py | 10 +++++----- 7 files changed, 27 insertions(+), 18 deletions(-) diff --git a/account_asset_management/account_asset.py b/account_asset_management/account_asset.py index de12154a0..5fc38ded1 100644 --- a/account_asset_management/account_asset.py +++ b/account_asset_management/account_asset.py @@ -824,10 +824,14 @@ class account_asset_asset(orm.Model): asset_value = self._asset_value_compute( cr, uid, asset, context) for rec in record.child_ids: - asset_value += \ - rec.type == 'normal' and \ - self._asset_value_compute(cr, uid, rec, context) or \ - _value_get(rec) + if rec.type == 'normal': + value = self._asset_value_compute(cr, + uid, + rec, + context) + else: + value = _value_get(rec) + asset_value += value return asset_value res[asset.id] = _value_get(asset) return res diff --git a/account_asset_management/wizard/account_asset_remove.py b/account_asset_management/wizard/account_asset_remove.py index ff948ee9f..e69195acc 100644 --- a/account_asset_management/wizard/account_asset_remove.py +++ b/account_asset_management/wizard/account_asset_remove.py @@ -258,8 +258,9 @@ class account_asset_remove(orm.TransientModel): } move_lines.append((0, 0, move_line_vals)) balance = wiz_data.sale_value - residual_value - account_id = balance > 0 and wiz_data.account_plus_value_id.id \ - or wiz_data.account_min_value_id.id + account_id = (wiz_data.account_plus_value_id.id + if balance > 0 + else wiz_data.account_min_value_id.id) move_line_vals = { 'name': asset.name, 'account_id': account_id, diff --git a/account_chart_update/wizard/wizard_chart_update.py b/account_chart_update/wizard/wizard_chart_update.py index 57bb20fac..e934e9d7a 100644 --- a/account_chart_update/wizard/wizard_chart_update.py +++ b/account_chart_update/wizard/wizard_chart_update.py @@ -1159,9 +1159,9 @@ class wizard_update_charts_accounts(orm.TransientModel): 'shortcut': account_template.shortcut, 'note': account_template.note, 'parent_id': ( - account_template.parent_id - and account_template_mapping.get(p_id) or - False + account_template_mapping.get(p_id) + if account_template.parent_id + else False ), 'tax_ids': [(6, 0, tax_ids)], 'company_id': wizard.company_id.id, diff --git a/account_credit_control/run.py b/account_credit_control/run.py index fd32be1dc..112fa0322 100644 --- a/account_credit_control/run.py +++ b/account_credit_control/run.py @@ -154,7 +154,8 @@ class CreditControlRun(orm.Model): ) generated_ids.extend(policy_generated_ids) if policy_generated_ids: - report += _("Policy \"%s\" has generated %d Credit Control Lines.\n") % \ + report += _('Policy "%s" has generated ' + '%d Credit Control Lines.\n') % \ (policy.name, len(policy_generated_ids)) credit_line_ids += policy_generated_ids else: diff --git a/account_renumber/test/create_moves.py b/account_renumber/test/create_moves.py index 93d1e9664..5b72afbe8 100644 --- a/account_renumber/test/create_moves.py +++ b/account_renumber/test/create_moves.py @@ -23,8 +23,9 @@ """ Script that creates large amounts of account moves on different days, that can be used later for testing the renumber wizard. + +author: Borja López Soilán (Pexego) """ -__author__ = "Borja López Soilán (Pexego)" import sys import xmlrpclib diff --git a/currency_rate_date_check/currency_rate_date_check.py b/currency_rate_date_check/currency_rate_date_check.py index 73cb041f3..c9fa1989d 100644 --- a/currency_rate_date_check/currency_rate_date_check.py +++ b/currency_rate_date_check/currency_rate_date_check.py @@ -60,8 +60,10 @@ class res_currency(orm.Model): context = {} # We only do the check if there is an explicit date in the context and # there is no specific currency_rate_type_id - if context.get('date') and not context.get('currency_rate_type_id') and\ - not context.get('disable_rate_date_check'): + if (context.get('date') and + not context.get('currency_rate_type_id') and + not context.get('disable_rate_date_check')): + for currency_id in ids: # We could get the company from the currency, but it's not a # 'required' field, so we should probably continue to get it diff --git a/l10n_fr_siret/partner.py b/l10n_fr_siret/partner.py index 13aac7653..dca17fba9 100644 --- a/l10n_fr_siret/partner.py +++ b/l10n_fr_siret/partner.py @@ -54,13 +54,13 @@ class Partner(orm.Model): return False if partner.siren: # Check the SIREN type, length and key - if (not partner.siren.isdecimal() - or len(partner.siren) != 9 - or not _check_luhn(partner.siren)): + if (not partner.siren.isdecimal() or + len(partner.siren) != 9 or + not _check_luhn(partner.siren)): return False # Check the NIC key (you need both SIREN and NIC to check it) - if partner.nic and not _check_luhn(partner.siren - + partner.nic): + if (partner.nic and + not _check_luhn(partner.siren + partner.nic)): return False return True