This question has been flagged
3641 Views

My company currency: INR. In the invoice i have selected "USD" currency. The invoice total showing in USD. I want to add one more total column to show invoice total in INR. How can i do this in openerp version 7.0? 

 

Avatar
Discard
Author

I got like this... Inherit the module like class account_invlice_extension(osv.osv): _inherit = "account.invoice" def _paid_amount_in_company_currency(self, cr, uid, ids, name, args, context=None): if context is None: context = {} res = {} ctx = context.copy() for v in self.browse(cr, uid, ids, context=context): voucher = self.browse(cr, uid, v.id, context=ctx) res[voucher.id] = self.pool.get('res.currency').compute(cr, uid, voucher.currency_id.id, voucher.company_id.currency_id.id, voucher.amount_total, context=ctx) return res _columns = { 'amount_toatl_cc':fields.function(_paid_amount_in_company_currency, type='float', digits_compute=dp.get_precision('Account'), string='Amount in Home Cur.',digits=(12,6)), } and show this amount_total_cc in view

Author

I got like this... Inherit the module like class account_invlice_extension(osv.osv): _inherit = "account.invoice" def _paid_amount_in_company_currency(self, cr, uid, ids, name, args, context=None): if context is None: context = {} res = {} ctx = context.copy() for v in self.browse(cr, uid, ids, context=context): voucher = self.browse(cr, uid, v.id, context=ctx) res[voucher.id] = self.pool.get('res.currency').compute(cr, uid, voucher.currency_id.id, voucher.company_id.currency_id.id, voucher.amount_total, context=ctx) return res _columns = { 'amount_toatl_cc':fields.function(_paid_amount_in_company_currency, type='float', digits_compute=dp.get_precision('Account'), string='Amount in Home Cur.',digits=(12,6)), } and show this amount_total_cc in view

I tied to use your solution but when I try to click or save an invoice it gives me this error : " File "/home/dbm/workspace_2/OpenERPv7/openerp/osv/fields.py", line 1151, in get elif result.get(id): AttributeError: 'NoneType' object has no attribute 'get' "

Please ! I need your help as soon as possible ! Mr Samba