Wednesday, February 10, 2016

How to change default and internal currency in self-hosted Odoo or OpenERP

If you wish to use Odoo in a single-currency environment, you will find issues changing the currency in the Odoo interface itself. If you have a self-hosted solution of Odoo or OpenERP, you already have unprecedented control over the system, unlike the cloud-based solution from Odoo. This means that you can very easily fix the issue by hacking the database that Odoo is relying on. Even in a multi-currency environment, you can use the same trick to change the global default currency - the fix is very clean for any environment - there is just an extra step to update the currency rate settings.

Even in the latest version of Odoo, we still face the ridiculous bug that Odoo internally ALWAYS uses EUR (Euro) as the internal currency. This has created many problems for many users wanting to use a different currency. Despite being set to a different currency from the Odoo interface, the eCommerce site, reports, accounting, etc are still shown using EUR and the Euro symbol, creating confusion and accounting problems.

Odoo Support has done nothing yet to correct this critical problem in their software which renders their otherwise excellent software for SME business into merely a toy for a hobbyist to play around with. The internet is full of dissatisfied Odoo customers looking for a solution, and many "solutions" revolve around playing with the accounting settings, multi-currency settings, currency rates, etc.

I don't know whether you have this problem or you can fix it if you purchased Odoo cloud service. But if you are installing and using a self-hosted Odoo solution, you can use the following trick to fix the issue at the very heart of Odoo. Since Odoo uses a Postgres database to store all the data, we can connect to the database directly and modify the data inside, thus changing the behavior of Odoo. NOTE that the database is like Windows registry or Linux /etc - drastic careless modification can render your whole Odoo system useless.

Note that you should not use the Odoo interface to change the default currency for the business or otherwise. If you already did so, now would be a good time to change it back to the default currency, which is the Euro (EUR). (Or after the below procedure, change to your target currency).

Log on to your server by SSH or PuTTY, and connect to the Postgres database client using the following command:
sudo -u postgres psql

Connect to your database using the command (replace <database name> with the actual name of your database - to see the list of databases, use \l ):
\c <database name>

Here you will require some knowledge about databases, SQL writing, and Postgres in particular. I will expand the post with some actual usable commands later. But following is the gist of procedure:
  1. In res_currency table, there will be an entry for EUR, and there may be an entry for your currency.
  2. Your fix will be to swap them around, so that the ID for EUR refers to your currency, and the ID for your currency refers to EUR. That way, your currency becomes the global default for Odoo.
  3. You can also fix the symbol of your currency. Note that this will usually require placing the SQL in an UTF-8 file so that your currency symbol can be stored in the table correctly - typing or pasting it directly into the terminal may convert the symbol to question mark or some other gibberish.
  4. If you could not find an entry for your currency, you will need to create it, then do the swapping with EUR.
  5. If you have stored currency rates in a multi-currency environment, you will also need to update res_currency_rate table to swap the ID for EUR and the ID for your new default currency.

No comments:

Post a Comment

Comments are moderated, and are usually posted within 24 hours if approved. You must have a minimum of OpenID to post comments.


Related Posts with Thumbnails