From 77753a3392e51383bfde55f63d063e5b81a6840a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Fri, 27 Feb 2015 15:47:35 +0100 Subject: [PATCH] [FIX] flake8 W503 --- .../models/payment_line.py | 12 ++++++------ .../wizard/payment_order_create.py | 6 +++--- .../model/account_payment.py | 16 ++++++++-------- .../model/payment_line.py | 10 +++++----- .../models/account_banking_mandate.py | 19 ++++++++++--------- .../wizard/export_sdd.py | 4 ++-- account_direct_debit/models/payment_line.py | 4 ++-- 7 files changed, 36 insertions(+), 35 deletions(-) diff --git a/account_banking_mandate/models/payment_line.py b/account_banking_mandate/models/payment_line.py index 93f56f9e0..7d7bb8cd7 100644 --- a/account_banking_mandate/models/payment_line.py +++ b/account_banking_mandate/models/payment_line.py @@ -40,12 +40,12 @@ class PaymentLine(models.Model): vals = {} partner_bank_id = vals.get('bank_id') move_line_id = vals.get('move_line_id') - if (self.env.context.get('search_payment_order_type') == 'debit' - and 'mandate_id' not in vals): + if (self.env.context.get('search_payment_order_type') == 'debit' and + 'mandate_id' not in vals): if move_line_id: line = self.env['account.move.line'].browse(move_line_id) - if (line.invoice and line.invoice.type == 'out_invoice' - and line.invoice.mandate_id): + if (line.invoice and line.invoice.type == 'out_invoice' and + line.invoice.mandate_id): vals.update({ 'mandate_id': line.invoice.mandate_id.id, 'bank_id': line.invoice.mandate_id.partner_bank_id.id, @@ -61,8 +61,8 @@ class PaymentLine(models.Model): @api.one @api.constrains('mandate_id', 'bank_id') def _check_mandate_bank_link(self): - if (self.mandate_id and self.bank_id - and self.mandate_id.partner_bank_id.id != + if (self.mandate_id and self.bank_id and + self.mandate_id.partner_bank_id.id != self.bank_id.id): raise exceptions.Warning( _("The payment line with reference '%s' has the bank account " diff --git a/account_banking_payment_export/wizard/payment_order_create.py b/account_banking_payment_export/wizard/payment_order_create.py index c18b935e0..90be9a94c 100644 --- a/account_banking_payment_export/wizard/payment_order_create.py +++ b/account_banking_payment_export/wizard/payment_order_create.py @@ -142,9 +142,9 @@ class PaymentOrderCreate(models.TransientModel): 'state': state, # end account banking 'date': date_to_pay, - 'currency': (line.invoice and line.invoice.currency_id.id - or line.journal_id.currency.id - or line.journal_id.company_id.currency_id.id)} + 'currency': (line.invoice and line.invoice.currency_id.id or + line.journal_id.currency.id or + line.journal_id.company_id.currency_id.id)} return res @api.multi diff --git a/account_banking_payment_transfer/model/account_payment.py b/account_banking_payment_transfer/model/account_payment.py index 0051527e8..6dff5bfd3 100644 --- a/account_banking_payment_transfer/model/account_payment.py +++ b/account_banking_payment_transfer/model/account_payment.py @@ -150,10 +150,10 @@ class PaymentOrder(models.Model): 'move_id': move.id, 'partner_id': partner_id, 'account_id': self.mode.transfer_account_id.id, - 'credit': (self.payment_order_type == 'payment' - and amount or 0.0), - 'debit': (self.payment_order_type == 'debit' - and amount or 0.0), + 'credit': (self.payment_order_type == 'payment' and + amount or 0.0), + 'debit': (self.payment_order_type == 'debit' and + amount or 0.0), } return vals @@ -172,10 +172,10 @@ class PaymentOrder(models.Model): 'move_id': move.id, 'partner_id': line.partner_id.id, 'account_id': account_id, - 'credit': (self.payment_order_type == 'debit' - and line.amount or 0.0), - 'debit': (self.payment_order_type == 'payment' - and line.amount or 0.0), + 'credit': (self.payment_order_type == 'debit' and + line.amount or 0.0), + 'debit': (self.payment_order_type == 'payment' and + line.amount or 0.0), } return vals diff --git a/account_banking_payment_transfer/model/payment_line.py b/account_banking_payment_transfer/model/payment_line.py index e55d170ef..3dc640a20 100644 --- a/account_banking_payment_transfer/model/payment_line.py +++ b/account_banking_payment_transfer/model/payment_line.py @@ -147,8 +147,8 @@ class PaymentLine(orm.Model): _('Move line %s has already been reconciled') % torec_move_line.name ) - if (transit_move_line.reconcile_id - or transit_move_line.reconcile_partial_id): + if (transit_move_line.reconcile_id or + transit_move_line.reconcile_partial_id): raise orm.except_orm( _('Error'), _('Move line %s has already been reconciled') % @@ -170,9 +170,9 @@ class PaymentLine(orm.Model): vals = { 'type': 'auto', 'line_id': is_zero(total) and [(6, 0, line_ids)] or [(6, 0, [])], - 'line_partial_ids': (is_zero(total) - and [(6, 0, [])] - or [(6, 0, line_ids)]), + 'line_partial_ids': (is_zero(total) and + [(6, 0, [])] or + [(6, 0, line_ids)]), } if torec_move_line.reconcile_partial_id: diff --git a/account_banking_sepa_direct_debit/models/account_banking_mandate.py b/account_banking_sepa_direct_debit/models/account_banking_mandate.py index 4df706378..170866798 100644 --- a/account_banking_sepa_direct_debit/models/account_banking_mandate.py +++ b/account_banking_sepa_direct_debit/models/account_banking_mandate.py @@ -80,8 +80,8 @@ class AccountBankingMandate(models.Model): @api.one @api.constrains('type', 'recurrent_sequence_type') def _check_recurring_type(self): - if (self.type == 'recurrent' - and not self.recurrent_sequence_type): + if (self.type == 'recurrent' and + not self.recurrent_sequence_type): raise exceptions.Warning( _("The recurrent mandate '%s' must have a sequence type.") % self.unique_mandate_reference) @@ -89,8 +89,8 @@ class AccountBankingMandate(models.Model): @api.one @api.constrains('type', 'recurrent_sequence_type', 'sepa_migrated') def _check_migrated_to_sepa(self): - if (self.type == 'recurrent' and not self.sepa_migrated - and self.recurrent_sequence_type != 'first'): + if (self.type == 'recurrent' and not self.sepa_migrated and + self.recurrent_sequence_type != 'first'): raise exceptions.Warning( _("The recurrent mandate '%s' which is not marked as " "'Migrated to SEPA' must have its recurrent sequence type " @@ -99,8 +99,8 @@ class AccountBankingMandate(models.Model): @api.one @api.constrains('type', 'original_mandate_identification', 'sepa_migrated') def _check_original_mandate_identification(self): - if (self.type == 'recurrent' and not self.sepa_migrated - and not self.original_mandate_identification): + if (self.type == 'recurrent' and not self.sepa_migrated and + not self.original_mandate_identification): raise exceptions.Warning( _("You must set the 'Original Mandate Identification' on the " "recurrent mandate '%s' which is not marked as 'Migrated to " @@ -111,9 +111,10 @@ class AccountBankingMandate(models.Model): def mandate_partner_bank_change(self): super(AccountBankingMandate, self).mandate_partner_bank_change() res = {} - if (self.state == 'valid' and self.partner_bank_id - and self.type == 'recurrent' - and self.recurrent_sequence_type != 'first'): + if (self.state == 'valid' and + self.partner_bank_id and + self.type == 'recurrent' and + self.recurrent_sequence_type != 'first'): self.recurrent_sequence_type = 'first' res['warning'] = { 'title': _('Mandate update'), diff --git a/account_banking_sepa_direct_debit/wizard/export_sdd.py b/account_banking_sepa_direct_debit/wizard/export_sdd.py index aa46ff8b1..2fffdda65 100644 --- a/account_banking_sepa_direct_debit/wizard/export_sdd.py +++ b/account_banking_sepa_direct_debit/wizard/export_sdd.py @@ -103,8 +103,8 @@ class BankingExportSddWizard(orm.TransientModel): previous_payline_id = False for older_line in older_lines: older_line_date_sent = older_line.order_id.date_sent - if (older_line_date_sent - and older_line_date_sent > previous_date): + if (older_line_date_sent and + older_line_date_sent > previous_date): previous_date = older_line_date_sent previous_payline_id = older_line.id if previous_payline_id: diff --git a/account_direct_debit/models/payment_line.py b/account_direct_debit/models/payment_line.py index c5fbe1898..655263ab5 100644 --- a/account_direct_debit/models/payment_line.py +++ b/account_direct_debit/models/payment_line.py @@ -93,8 +93,8 @@ class PaymentLine(orm.Model): {'storno': True}, context=context) # put forth the invoice workflow if line.move_line_id.invoice: - activity = (storno_retry and 'open_test' - or 'invoice_debit_denied') + activity = (storno_retry and 'open_test' or + 'invoice_debit_denied') netsvc.LocalService("workflow").trg_validate( uid, 'account.invoice', line.move_line_id.invoice.id, activity, cr)