Skip to content

Commit

Permalink
Merge PR #476 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by alexis-via
  • Loading branch information
OCA-git-bot committed Sep 18, 2023
2 parents 9dd9a33 + 5fc4f90 commit d362596
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions l10n_fr_chorus_account/models/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
except ImportError:
logger.debug("Cannot import requests-oauthlib")

API_URL = "https://api.aife.economie.gouv.fr"
QUALIF_API_URL = "https://sandbox-api.aife.economie.gouv.fr"
TOKEN_URL = "https://oauth.aife.economie.gouv.fr/api/oauth/token"
QUALIF_TOKEN_URL = "https://sandbox-oauth.aife.economie.gouv.fr/api/oauth/token"
API_URL = "https://api.piste.gouv.fr"
QUALIF_API_URL = "https://sandbox-api.piste.gouv.fr"
TOKEN_URL = "https://oauth.piste.gouv.fr/api/oauth/token"
QUALIF_TOKEN_URL = "https://sandbox-oauth.piste.gouv.fr/api/oauth/token"
MARGIN_TOKEN_EXPIRY_SECONDS = 240
TIMEOUT = 30


class ResCompany(models.Model):
Expand Down Expand Up @@ -159,6 +160,7 @@ def _get_new_token(self, oauth_id, oauth_secret, qualif):
"client_secret": oauth_secret,
"scope": "openid",
},
timeout=TIMEOUT,
)
logger.debug("_get_new_token HTTP answer code=%s", r.status_code)
except requests.exceptions.ConnectionError as e:
Expand Down Expand Up @@ -257,7 +259,11 @@ def chorus_post(self, api_params, url_path, payload, session=None):
logger.debug("Payload of the Chorus POST request: %s", payload)
try:
r = session.post(
url, verify=True, data=json.dumps(payload), headers=headers
url,
verify=True,
data=json.dumps(payload),
headers=headers,
timeout=TIMEOUT,
)
except requests.exceptions.ConnectionError as e:
logger.error("Connection to %s failed. Error: %s", url, e)
Expand Down
2 changes: 1 addition & 1 deletion l10n_fr_chorus_account/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ On the customers that you invoice via Chorus, you must:

If you want to use the Chorus API to easily send invoices to Chorus from Odoo, you must:

* edit the Odoo server configuration file and add two keys *chorus_api_oauth_id* and *chorus_api_oauth_secret* that contain your Oauth client ID and client secret obtained via `PISTE <https://developer.aife.economie.gouv.fr/>`_. Don't forget to restart the Odoo server after the update of its configuration file.
* edit the Odoo server configuration file and add two keys *chorus_api_oauth_id* and *chorus_api_oauth_secret* that contain your Oauth client ID and client secret obtained via `PISTE <https://piste.gouv.fr/>`_. Don't forget to restart the Odoo server after the update of its configuration file.

* in the menu *Accounting > Configuration > Settings*, in the section *Chorus API*, enable the option *Use Chorus API*, which will add all users to the *Chorus API* group. Then set the additional configuration parameters for Chorus API that will be prompted on the settings page.

Expand Down

0 comments on commit d362596

Please sign in to comment.