mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[FIX] flake8 W503
This commit is contained in:
@@ -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 "
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user