How to Load RBA Exchange Rates into Odoo
Odoo can update currency rates automatically, but none of its built-in providers is the Reserve Bank of Australia. If your accountant expects RBA rates, you need to load them yourself.
Odoo stores rates in the res.currency.rate model. This guide gives you a Python script that fetches the RBA rates from the Exchange Rates API and writes them through Odoo's external XML-RPC API, so it works with Odoo Online, Odoo.sh and self-hosted installs alike.
Using a different system? See the ERP integration overview for SAP, Xero, NetSuite, Business Central and Excel.
Before You Start
The API returns rates as units of foreign currency per 1 AUD, which is how the RBA publishes them:
{
"success": true,
"timestamp": 1725080400,
"base": "AUD",
"date": "2025-08-31",
"rates": {
"USD": 0.643512,
"EUR": 0.562934,
"JPY": 96.8321
}
}
Four things to get right for Odoo:
- Direction. Odoo stores rates as units of currency per 1 company currency, the same direction as the API. With AUD as the company currency, you load
rateas-is. - TWI and SDR. TWI is an index, not a currency, so skip it. SDR's ISO code is XDR; skip it unless you've activated XDR. The script skips both.
- Weekends and public holidays. The RBA doesn't publish on those days. Odoo uses the most recent rate on or before the transaction date, so you only need to load the days the RBA publishes. Use the
datefrom the response, never today's date. - Timing. The RBA publishes around 4 PM AEST. Schedule the script for 5 PM Sydney time or later on business days.
The Python Script
import xmlrpc.client
import requests
RBA_KEY = "your_api_key_here"
ODOO_URL, ODOO_DB = "https://yourcompany.odoo.com", "yourcompany"
ODOO_USER, ODOO_API_KEY = "finance@yourcompany.com.au", "odoo_api_key"
data = requests.get(
"https://api.exchangeratesapi.com.au/latest",
headers={"Authorization": f"Bearer {RBA_KEY}"},
timeout=30,
).json()
common = xmlrpc.client.ServerProxy(f"{ODOO_URL}/xmlrpc/2/common")
uid = common.authenticate(ODOO_DB, ODOO_USER, ODOO_API_KEY, {})
models = xmlrpc.client.ServerProxy(f"{ODOO_URL}/xmlrpc/2/object")
def call(model, method, *args, **kwargs):
return models.execute_kw(ODOO_DB, uid, ODOO_API_KEY, model, method, list(args), kwargs)
for code, rate in data["rates"].items():
if code in ("TWI", "SDR"):
continue
currency_ids = call("res.currency", "search", [["name", "=", code]])
if not currency_ids:
continue
existing = call("res.currency.rate", "search",
[["currency_id", "=", currency_ids[0]], ["name", "=", data["date"]]])
values = {"currency_id": currency_ids[0], "name": data["date"], "rate": rate}
if existing:
call("res.currency.rate", "write", existing, values)
else:
call("res.currency.rate", "create", values)
print(f"{code} {data['date']}: {rate}")
Odoo Settings to Change
- Turn off automatic rates. Disable Automatic Currency Rates (Accounting → Settings → Currencies) so Odoo doesn't overwrite your RBA rates with another provider's.
- Activate the currencies you need. The script only loads currencies that exist in
res.currency. Inactive currencies may not be returned by the search, so activate the ones you trade in first. - Multi-company databases. Add
company_idto both the search domain and the values so each company gets its own rates.
Scheduling
Run the script with cron, Windows Task Scheduler or any job runner at 5 PM Sydney time on weekdays. Create a dedicated Odoo user with an API key (Preferences → Account Security) and keep both keys in environment variables rather than in the script.
Before You Go Live
- Test against a staging database and compare a few rates against the RBA's published table.
- Safe to re-run. The script updates an existing rate for the same currency and date, so a job that runs twice won't create duplicates.
- Alerting. Send the script's output somewhere people look, so a missed day is caught before month-end. The API's
/statusendpoint helps when troubleshooting. - Backfill. When you first go live, load historical rates for open periods using
/timeseries. Full history back to 2018 is on Professional and above.
Which Plan Do You Need?
A daily load uses about 22 requests a month, so Starter covers it. Move to Professional if you need history beyond the last 30 days for a backfill, or want a rate-published webhook to trigger the load as soon as rates arrive.
Ready to use RBA rates in Odoo? Get your free API key and try the script against a staging database today.
Data sourced from the Reserve Bank of Australia. We are not affiliated with or endorsed by the Reserve Bank of Australia.
Odoo is a trademark of Odoo S.A. Code samples are provided as starting points. Test them against a staging database and review them with your Odoo partner before using them in production.
For API documentation, visit Exchange Rates API Docs