Skip to content

Commit

Permalink
[FIX] l10n_do_currency_update : add confir parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
fernando-pcg committed Nov 6, 2024
1 parent 6b199d5 commit 9d50769
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion l10n_do_currency_update/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"website": "https://www.indexa.do",
"category": "Accounting",
"license": "LGPL-3",
"version": "15.0.1.0.0",
"version": "15.0.1.0.1",
"depends": ["account"],
"data": [
"data/ir_cron_data.xml",
Expand Down
5 changes: 5 additions & 0 deletions l10n_do_currency_update/data/ir_config_parameter_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@
<field name="key">indexa.api.token</field>
<field name="value">false</field>
</record>
<record id="l10n_do_currency_update_api_token_name" model="ir.config_parameter">
<field name="key">indexa.api.token.name</field>
<field name="value">x-access-token</field>
</record>


</odoo>
5 changes: 4 additions & 1 deletion l10n_do_currency_update/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,12 @@ class ResCompany(models.Model):

def get_currency_rates(self, params, token):
api_url = self.env["ir.config_parameter"].sudo().get_param("indexa.api.url")
token_name = (
self.env["ir.config_parameter"].sudo().get_param("indexa.api.token.name")
)

try:
response = requests.get(api_url, params, headers={"x-access-token": token})
response = requests.get(api_url, params, headers={token_name: token})
except requests.exceptions.ConnectionError as e:
_logger.warning(_("API requests return the following error %s" % e))
return {}
Expand Down

0 comments on commit 9d50769

Please sign in to comment.