From 4683ad60c0dd73f4bc5462af3960875b8ddd55ab Mon Sep 17 00:00:00 2001 From: manu Date: Wed, 13 Apr 2022 13:09:36 +0200 Subject: [PATCH] [MIG]account_statement_import_online: Migration to 15.0 --- .../__manifest__.py | 2 +- .../models/online_bank_statement_provider.py | 18 ++++++++---------- ...est_account_bank_statement_import_online.py | 4 ++-- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/account_statement_import_online/__manifest__.py b/account_statement_import_online/__manifest__.py index 177135c9..ab9a6d2b 100644 --- a/account_statement_import_online/__manifest__.py +++ b/account_statement_import_online/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Online Bank Statements", - "version": "14.0.2.1.1", + "version": "15.0.1.0.0", "author": "CorporateHub, Odoo Community Association (OCA)", "maintainers": ["alexey-pelykh"], "website": "https://github.com/OCA/bank-statement-import", diff --git a/account_statement_import_online/models/online_bank_statement_provider.py b/account_statement_import_online/models/online_bank_statement_provider.py index 2366fb72..85e21af1 100644 --- a/account_statement_import_online/models/online_bank_statement_provider.py +++ b/account_statement_import_online/models/online_bank_statement_provider.py @@ -25,7 +25,7 @@ class OnlineBankStatementProvider(models.Model): company_id = fields.Many2one(related="journal_id.company_id", store=True) active = fields.Boolean(default=True) - name = fields.Char(string="Name", compute="_compute_name", store=True) + name = fields.Char(compute="_compute_name", store=True) journal_id = fields.Many2one( comodel_name="account.journal", required=True, @@ -67,7 +67,6 @@ class OnlineBankStatementProvider(models.Model): required=True, ) update_schedule = fields.Char( - string="Update Schedule", compute="_compute_update_schedule", ) last_successful_run = fields.Datetime(string="Last successful pull") @@ -95,7 +94,7 @@ class OnlineBankStatementProvider(models.Model): certificate_public_key = fields.Text() certificate_private_key = fields.Text() certificate_chain = fields.Text() - allow_empty_statements = fields.Boolean(string="Allow empty statements") + allow_empty_statements = fields.Boolean() _sql_constraints = [ ( @@ -173,13 +172,12 @@ class OnlineBankStatementProvider(models.Model): provider.message_post( body=_( "Failed to obtain statement data for period " - "since %s until %s: %s. See server logs for " + "since {since} until {until}: {exception}. See server logs for " "more details." - ) - % ( - statement_date_since, - statement_date_until, - escape(str(e)) or _("N/A"), + ).format( + since=statement_date_since, + until=statement_date_until, + exception=escape(str(e)) or _("N/A"), ), subject=_("Issue with Online Bank Statement Provider"), ) @@ -402,7 +400,7 @@ class OnlineBankStatementProvider(models.Model): "Pulling online bank statements of: %s" % ", ".join(providers.mapped("journal_id.name")) ) - for provider in providers.with_context({"scheduled": True}): + for provider in providers.with_context(**{"scheduled": True}): date_since = ( (provider.last_successful_run) if provider.last_successful_run diff --git a/account_statement_import_online/tests/test_account_bank_statement_import_online.py b/account_statement_import_online/tests/test_account_bank_statement_import_online.py index 7d0a5c17..4d7ff23a 100644 --- a/account_statement_import_online/tests/test_account_bank_statement_import_online.py +++ b/account_statement_import_online/tests/test_account_bank_statement_import_online.py @@ -21,7 +21,7 @@ mock_obtain_statement_data = ( ) -class TestAccountBankAccountStatementImportOnline(common.SavepointCase): +class TestAccountBankAccountStatementImportOnline(common.TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() @@ -360,7 +360,7 @@ class TestAccountBankAccountStatementImportOnline(common.SavepointCase): provider.active = True provider.statement_creation_mode = "weekly" - with self.assertRaises(Exception): + with self.assertRaisesRegex(Exception, "Expected"): provider.with_context(crash=True)._pull( self.now - relativedelta(hours=1), self.now,