Browse Source
[FIX] *_online_ponto: Backport 4a8f9ac better code organisation
12.0
Ronald Portier (Therp BV)
2 years ago
No known key found for this signature in database
GPG Key ID: A181F8124D7101D3
1 changed files with
23 additions and
24 deletions
-
account_bank_statement_import_online_ponto/models/online_bank_statement_provider_ponto.py
|
|
@ -159,7 +159,11 @@ class OnlineBankStatementProviderPonto(models.Model): |
|
|
|
response = requests.get( |
|
|
|
page_url, params=params, headers=self._ponto_header() |
|
|
|
) |
|
|
|
if response.status_code == 200: |
|
|
|
if response.status_code != 200: |
|
|
|
raise UserError( |
|
|
|
_("Error during get transaction.\n\n%s \n\n %s") |
|
|
|
% (response.status_code, response.text) |
|
|
|
) |
|
|
|
if params.get("before"): |
|
|
|
params.pop("before") |
|
|
|
data = json.loads(response.text) |
|
|
@ -182,11 +186,6 @@ class OnlineBankStatementProviderPonto(models.Model): |
|
|
|
if not page_next or (page_next and not latest_identifier): |
|
|
|
latest_identifier = current_transactions[0].get("id") |
|
|
|
transaction_lines.extend(current_transactions) |
|
|
|
else: |
|
|
|
raise UserError( |
|
|
|
_("Error during get transaction.\n\n%s \n\n %s") |
|
|
|
% (response.status_code, response.text) |
|
|
|
) |
|
|
|
if latest_identifier: |
|
|
|
self.ponto_last_identifier = latest_identifier |
|
|
|
return transaction_lines |
|
|
|