Odoo Help


Using database to compare and retrieve currency conversion rate

Odoo Programmer
on 12/22/15, 11:32 AM 1,267 views

 I am trying to loop through a database in order to do a comparison between the currency used by a supplier and the currency that Odoo has as the default currency.  Lets say that the currency that is used by the supplier is the Euro.  My default currency is the US Dollar.  What I would like to do then, is take the currency used by the supplier, do a comparison by currency_id in the res_currency_rate table in the Odoo database.  If both of them match, then I retrieve the exchange rate so that when I enter a price for a product from that particular supplier, the number is taken, multiplied by the conversion rate (USD to EUR) and then the converted price appears instantly on the screen.  I want to avoid hard coding as much as possible, so that I can use this method with different suppliers who use different currencies.

I have searched and tried myself to figure out how to do this, but it does not work out. 

To be more specific, here is where I am having trouble:

id = self.supplier_name.currency.id 
curr_rec = self.env['res.currency.rate'].search([id,'=', 'currency_id'])
for rec in curr_rec:
   if curr_rec == 'res.currency.rate.currency_id':
     self.price_EUR = self.price * self.supplier_name.currency.rate

Any suggestions?




Ray Carnes

--Ray Carnes--
| 9 7 9
Keyport, United States
--Ray Carnes--

Senior ERP Analyst

OpenERP 6.1, 7.0; Odoo 8.0, 9.0, 10.0 and 11.0.

Completed Odoo Functional and Technical Training.

Functional Areas:

  • CRM/Sales

  • Inventory

  • Manufacturing

  • Accounting

  • Purchasing

Major Skills:

  • Business Process Reengineering

  • Efficiency Consulting

  • User Needs and GAP Analysis;

  • Functional and Technical Design;

  • Prototyping and Proof of Concepts;

  • Requirements Specifications;

  • Agile Implementation;

  • Data Migration;

  • Configuration & Customization (UI and code);

  • Integration - Odoo and non Odoo Applications and Services;

  • Training and Knowledge Transfer;

  • Go Live Support;

  • Helpdesk;

  • Version Upgrades and Migration.

  • Accounting Expert.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

I am a skilled Communicator and I only take the serious things seriously!

Ray Carnes
On 12/22/15, 1:18 PM

Just create a pricelist for each currency that is based on the Public price (in USD) of each product and it will convert for you.

When the EURO pricelist is selected, a product with a price of $100 USD will be shown with a price of 91.

You can even set the default pricelist for each Supplier to "their" currency, defaulting the selection of the pricelist for all orders so they automatically get converted correctly each time an order is created.

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 12/22/15, 11:32 AM
Seen: 1267 times
Last updated: 12/22/15, 8:53 PM