diff --git a/l10n_fr_chorus_account/models/res_company.py b/l10n_fr_chorus_account/models/res_company.py index 60b9bcc05a..deb44940f2 100644 --- a/l10n_fr_chorus_account/models/res_company.py +++ b/l10n_fr_chorus_account/models/res_company.py @@ -240,7 +240,7 @@ def _get_token(self, api_params): logger.debug("_get_token expiry_date_gmt=%s now=%s", expiry_date_gmt, now) if now > expiry_date_gmt: # force clear cache - self._get_new_token.clear_cache(self.env[self._name]) + # self._get_new_token.clear_cache(self.env[self._name]) logger.info("PISTE Token cleared from cache.") token, expiry_date_gmt = self._get_new_token( api_params["oauth_id"], api_params["oauth_secret"], api_params["qualif"] @@ -263,7 +263,7 @@ def _chorus_post(self, api_params, url_path, payload, session=None): "cpro-account": auth_piste_b64, } # The header Authorization: Bearer is automatically added by the session - if session is None: + if not session: token = self._get_token(api_params) session = OAuth2Session(api_params["oauth_id"], token=token) logger.info(