Thursday, January 20, 2011

Hell in point of sale

  1.   def test_paid(self, cr, uid, ids, context=None):     
  2.         """ Test all amount is paid for this order
  3.        @return: True
  4.        """
  5.         for order in self.browse(cr, uid, ids, context=context):
  6.             if order.lines and not order.amount_total:
  7.                 return True
  8.             if (not order.lines) or (not order.statement_ids) or \
  9.                 Decimal(str(order.amount_total)) != Decimal(str(order.amount_paid)):
  10.                 return False
  11.         return True

    Coming from the point_of_sale module in addons, find the hell!

    I help you, this code bugs the point of sale when we change the price accuracy of OpenERP

1 comment:

  1. Hey,

    Can you point out where this code comes from. Why is OpenERP using Decimals now - did someone manage to prove fabien's floating point theory wrong ?