[MIG]account_statement_import_online_ponto: Migration to 15.0

This commit is contained in:
manu
2022-04-13 14:03:04 +02:00
parent 12862dd2dd
commit b3d2d39414
3 changed files with 13 additions and 7 deletions

View File

@@ -3,7 +3,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Online Bank Statements: MyPonto.com",
"version": "14.0.1.1.0",
"version": "15.0.1.0.0",
"category": "Account",
"website": "https://github.com/OCA/bank-statement-import",
"author": "Florent de Labarre, Odoo Community Association (OCA)",

View File

@@ -83,7 +83,9 @@ class OnlineBankStatementProviderPonto(models.Model):
)
self.sudo().ponto_token_expiration = expiration_date
else:
raise UserError(_("%s \n\n %s") % (response.status_code, response.text))
raise UserError(
_("{} \n\n {}").format(response.status_code, response.text)
)
return {
"Accept": "application/json",
"Authorization": "Bearer %s" % self.ponto_token,
@@ -103,7 +105,7 @@ class OnlineBankStatementProviderPonto(models.Model):
)
res[iban] = account.get("id")
return res
raise UserError(_("%s \n\n %s") % (response.status_code, response.text))
raise UserError(_("{} \n\n {}").format(response.status_code, response.text))
def _ponto_synchronisation(self, account_id):
url = PONTO_ENDPOINT + "/synchronizations"
@@ -123,8 +125,9 @@ class OnlineBankStatementProviderPonto(models.Model):
sync_id = data.get("attributes", {}).get("resourceId", False)
else:
raise UserError(
_("Error during Create Synchronisation %s \n\n %s")
% (response.status_code, response.text)
_("Error during Create Synchronisation {} \n\n {}").format(
response.status_code, response.text
)
)
# Check synchronisation
@@ -158,8 +161,9 @@ class OnlineBankStatementProviderPonto(models.Model):
)
if response.status_code != 200:
raise UserError(
_("Error during get transaction.\n\n%s \n\n %s")
% (response.status_code, response.text)
_("Error during get transaction.\n\n{} \n\n {}").format(
response.status_code, response.text
)
)
if params.get("before"):
params.pop("before")

View File

@@ -29,6 +29,8 @@ class TestAccountBankAccountStatementImportOnlineQonto(common.TransactionCase):
self.AccountBankStatementLine = self.env["account.bank.statement.line"]
self.AccStatemenPull = self.env["online.bank.statement.pull.wizard"]
self.currency_eur.write({"active": True})
self.bank_account = self.ResPartnerBank.create(
{
"acc_number": "FR0214508000302245362775K46",