From 6a444182daa9451ff818fe24331a80ff2dd3078f Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Mon, 13 May 2019 15:27:24 +0200 Subject: [PATCH] Fix lint warnings --- .../tests/test_paypal_statement_import.py | 10 +++++++--- .../wizards/account_bank_statement_import_paypal.py | 10 +++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/account_bank_statement_import_paypal/tests/test_paypal_statement_import.py b/account_bank_statement_import_paypal/tests/test_paypal_statement_import.py index ea0d6b9..196662a 100644 --- a/account_bank_statement_import_paypal/tests/test_paypal_statement_import.py +++ b/account_bank_statement_import_paypal/tests/test_paypal_statement_import.py @@ -42,8 +42,10 @@ class TestPaypalFile(common.SavepointCase): # Current statements before to run the wizard old_statements = self.env['account.bank.statement'].search([]) # This journal is for Paypal statements - map = self.env.ref('account_bank_statement_import_paypal.paypal_map') - self.journal.paypal_map_id = map.id + paypal_map = self.env.ref( + 'account_bank_statement_import_paypal.paypal_map' + ) + self.journal.paypal_map_id = paypal_map.id file = self._do_import('paypal_en.csv') file = base64.b64encode(file.encode("utf-8")) wizard = self.env['account.bank.statement.import'].with_context({ @@ -55,4 +57,6 @@ class TestPaypalFile(common.SavepointCase): self.assertEqual(len(statement.line_ids), 3) self.assertEqual(len(statement.mapped('line_ids').filtered( lambda x: x.partner_id and x.account_id)), 1) - self.assertAlmostEqual(sum(statement.mapped('line_ids.amount')), 1489.2) + self.assertAlmostEqual( + sum(statement.mapped('line_ids.amount')), 1489.2 + ) diff --git a/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py b/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py index 25b2254..ba79b53 100644 --- a/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py +++ b/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py @@ -80,19 +80,19 @@ class AccountBankStatementImport(models.TransientModel): def _convert_paypal_line_to_dict(self, idx, line): rline = dict() for item in range(len(line)): - map = self.mapped('paypal_map_id.map_line_ids')[item] + paypal_map = self.mapped('paypal_map_id.map_line_ids')[item] value = line[item] - if not map.field_to_assign: + if not paypal_map.field_to_assign: continue - if map.date_format: + if paypal_map.date_format: try: value = fields.Date.to_string( - datetime.strptime(value, map.date_format)) + datetime.strptime(value, paypal_map.date_format)) except Exception: raise UserError( _("Date format of map file and Paypal date does " "not match.")) - rline[map.field_to_assign] = value + rline[paypal_map.field_to_assign] = value for field in ['commission', 'amount', 'balance']: _logger.debug('Trying to convert %s to float' % rline[field])