Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Convert the amount in company currency using the currency rate and voucher conversion in openerp

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 270
    Comment on it

    To convert the amount in company currency using the currency rate and voucher conversion in openerp. use this function def _convert_amount in .py file in account voucher module in openerp

    def _convert_amount(self, cr, uid, amount, voucher_id, context=None):
    
            currency_obj = self.pool.get('res.currency')
            voucher = self.browse(cr, uid, voucher_id, context=context)
            res = amount
            if voucher.payment_rate_currency_id.id == voucher.company_id.currency_id.id:
                # the rate specified on the voucher is for the company currency
    #            rate_between_voucher_and_base = voucher.currency_id.rate or 1.0
    #            rate_between_base_and_company = voucher.payment_rate or 1.0
    #            res = currency_obj.round(cr, uid, voucher.company_id.currency_id, (amount / rate_between_voucher_and_base * rate_between_base_and_company))
                res = currency_obj.round(cr, uid, voucher.company_d.currency_id, (amount * voucher.payment_rate))#
            else:
                # the rate specified on the voucher is not relevant, we use all the rates in the system
                res = currency_obj.compute(cr, uid, voucher.currency_id.id, voucher.company_id.currency_id.id, amount, context=context)
            return res
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: