← Back to team overview

openerp-india team mailing list archive

Re: [Openerp-expert-accounting] [Bug 865387] Re: wrong currency rounding

 

On 09/20/2012 11:54 AM, nicolas moreau wrote:
> In more detail the issue we found shows up  in account_voucher.py/voucher_move_line_create
> While calculating the amount on line 1082
> amount_currency = currency_obj.compute(cr, uid, company_currency, line.move_line_id
> this returned -2086.4000000000001 in our example, it should have been -2086.4000
> This then fails later in reconciliation since -2086.4000000000001 != -2086.4000
>

Hello Nicolas,
could you please provide the steps to reproduce your problem?


-- 
Lorenzo Battistini

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/865387

Title:
  wrong currency rounding

Status in OpenERP Addons (modules):
  Fix Released

Bug description:
  openobject-addons/6.0 revno 4863

  Steps:

   - Configure 'account' module using EUR currency
   - Configure a bank journal for USD currency
   - Create a new rate for USD currency, with date 2011-10-01
   - Create a new invoice, with date 2011-09-01, selecting USD currency and inserting one line of 3638.97 amount
   - Pay the invoice selecting 'Reconcile with Write-Off' (with today's date)

  The write.off entry is not created (it should be produced by the different currency rates).
  This is because of line 88 of base/res/res_currency.py :

  round(amount / currency.rounding) * currency.rounding
  3638.9700000000003

  and this makes false the line 719 of account_voucher.py (line.amount
  == line.amount_unreconciled)

  
  I think the line

  return round(amount / currency.rounding) * currency.rounding

  should be replaced by something like

  float(Decimal(str(amount)).quantize(Decimal(str(currency.rounding)),
  rounding=ROUND_HALF_UP))

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/865387/+subscriptions


References