Browse Source

[FIX] account_bank_statement_import_online_qonto: Avoid errors if year is different

TT40742
12.0_fix_qonto_2022_date
Víctor Martínez 2 years ago
committed by Nicolas JEUDY
parent
commit
48c2625d90
  1. 9
      account_bank_statement_import_online_qonto/models/online_bank_statement_provider_qonto.py

9
account_bank_statement_import_online_qonto/models/online_bank_statement_provider_qonto.py

@ -5,7 +5,7 @@ import json
from datetime import datetime
import pytz
from odoo import api, models, _
from odoo import _, api, fields, models
from odoo.exceptions import UserError
from odoo.addons.base.models.res_bank import sanitize_account_number
@ -66,7 +66,12 @@ class OnlineBankStatementProviderQonto(models.Model):
self.ensure_one()
url = QONTO_ENDPOINT + "/transactions"
params = {"slug": slug, "iban": self.account_number}
# settled_at_to param isn't well formatted (ISO 8601) or year is out of range".
# We set the last day of the year in such case.
if date_since and date_until and date_since.year != date_until.year:
date_until = fields.Datetime.from_string(
"%s-12-31 23:59:59" % date_since.year
)
if date_since:
params["settled_at_from"] = (
date_since.replace(microsecond=0).isoformat() + "Z"

Loading…
Cancel
Save