0

I need to hide all decimal values from the sub_total and total_amount of the sale_orders.

For that opened the currency settings from _ Accounting->Multicurrencies -> Currencies _ and then set Rounding Factor from 0.010000 to 0.000000 (got this clue from somewhere on the internet).

However, this produces a divide by zero error on Confirm Sale, when the total_amount is zero (due to 100% discounts)- specifically at

File "/opt/bahmni-erp/odoo/addons/account/models/account_move.py", line 63, in _compute_matched_percentage
    move.matched_percentage = total_reconciled / total_amount

The code block at that location is

if float_is_zero(total_amount, precision_rounding=precision_currency.rounding):
       move.matched_percentage = 1.0
else:
       move.matched_percentage = total_reconciled / total_amount

That float_is_zero is calling some other set of functions and finally executes the else part and the division error.


When I set the rounding to 1.000000 - I think the issue is getting resolved and there's no such error now.

I couldn't find much documentation about the behavior of this field and how it's getting used under Odoo.

Could you please confirm whether the above solution is okay and won't make any more side effects?

Thanks.

Kenly
  • 24,317
  • 7
  • 44
  • 60
art
  • 1,358
  • 1
  • 10
  • 24

1 Answers1

0

To work around this,

change digits from (12,6) to (12,10).

Find file vim /usr/lib/python2.7/site-packages/openerp/addons/base/res/res_currency.py and search for the next strings:

1- First Change:

rate= fields.function(_get_current_rate, string='Current Rate', digits=(12,10),                    

2- Second Change:

class res_currency_rate(osv.osv):
        _name = "res.currency.rate"      

      _description = "Currency Rate"
      rate= fields.float('Rate', digits=(12, 10), help='The rate of the currency to the currency of rate 1'),

Hope It helped.

Kenly
  • 24,317
  • 7
  • 44
  • 60