Odoo Help

Welcome!

This community 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.

0

How to print the Trial Balance, Profit & Loss and Balance sheet in the other currencies

By
Ganesh
on 8/4/14, 7:11 AM 704 views

As of now, the trail balance, profit and loss and balance sheet are prinited in the currency (base currency of the company).

If I want to print all the above said report in other currencies (user selection) how to generate the report.

Could somebody guide in this please

Ganesh

0
Ganesh
On 8/5/14, 3:07 AM

Hi Ben Bernard

Thanks for your reply.  But am not using the webkit report.  Just am using the default reports (TB, P&L and BS).

Could you help me out in this regards

Thanks

Ganesh

I updated my answer. Good luck.

Ben Bernard
on 8/5/14, 3:53 AM
0

Ben Bernard

--Ben Bernard--
1083
| 4 3 6
Jakarta, Indonesia
--Ben Bernard--
Ben Bernard
On 8/4/14, 8:06 AM

As a note, converting currency is depend on time. You can define currencies in res.currency model (Accounting > Configuration > Miscelaneous > Currencies). In the following example I assume you use account_financial_report_webkit module (to access python easier), system currency in USD and want to convert to IDR. Check account_report_trial_balance.mako. In this file add the following script.

date = time.strftime('%Y-%m-%d')

rate_pool = self.pool.get('res.currency.rate')

curr_pool = self.pool.get('res.currency')

curr_id = curr_pool.search(cr, uid, [('name', '=', 'IDR')])[0]

rate_ids = rate_pool.search(cr, uid, [('currency_id', '=', curr_id),
                                              ('name', '<=', date)], context=context)

rate_obj = rate_pool.browse(cr, uid, rate_ids[0], context=context)
        
rate = rate_obj.rate

Then in every occurence of amount, multiply this by rate. For example,

formatLang(current_account.debit * rate)

-- begin updated answer --

What is the default? It depends on Odoo version (last time I check Odoo migrating to QWeb). I don't have experience using QWeb. If you still use sxw, then you can transfer result of some method that generate the rate and call it in the sxw file. Check python script that generate data for sxw file (in folder report), then

  1. Define new method in that file, for example example get_converted_value(self, object), with return value = {'val': rate * value, 'currecy_id': curr_id}. Where value is amount you want to convert.
  2. In __init__ update localcontext hash to include get_converted_value. self.localcontext.update({ 'get_converted_value': self.get_converted_value})
  3. Go to corresponding sxw file, usually the same name with extension .sxw. Open it in OpenERP Designer addons for OpenOffice.
    1. call get_converted_value, something like

[[ repeatIn(get_converted_value(object), 'value') ]]

Value: [[ formatLang(value['val'], currency_obj=value['currency_id']) ]]

 

ref

https://doc.odoo.com/6.1/developer/05_reports/

 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/4/14, 7:11 AM
Seen: 704 times
Last updated: 3/16/15, 8:10 AM