[Erp5-report] r21184 - /erp5/trunk/products/ERP5/tests/testOrder.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed May 28 10:50:11 CEST 2008


Author: jerome
Date: Wed May 28 10:50:09 2008
New Revision: 21184

URL: http://svn.erp5.org?rev=21184&view=rev
Log:
Delivery.getTotalPrice fails with this kind of traceback:
  Module Products.ERP5Type.Document.Order, line 76, in getTotalPrice
  Module Products.ERP5.Document.Delivery, line 124, in getTotalPrice
  TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
when this delivery contain a cell where price is not defined.
This test case reproduces this bug


Modified:
    erp5/trunk/products/ERP5/tests/testOrder.py

Modified: erp5/trunk/products/ERP5/tests/testOrder.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testOrder.py?rev=21184&r1=21183&r2=21184&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testOrder.py (original)
+++ erp5/trunk/products/ERP5/tests/testOrder.py Wed May 28 10:50:09 2008
@@ -2017,6 +2017,33 @@
 
     self.assertEquals(cell.getTotalQuantity(), 4)
     self.assertEquals(cell.getTotalPrice(), 12)
+
+    # if cell has no price, the total price is None, but a default value can be
+    # provided
+    cell.setPrice(None)
+    get_transaction().commit()
+    self.tic()
+
+    self.assertEquals(order_line.isMovement(), False)
+    self.assertEquals(cell.isMovement(), True)
+
+    self.assertEquals(order.getTotalQuantity(fast=0), 4)
+    self.assertEquals(order.getTotalQuantity(fast=1), 4)
+    self.assertEquals(order.getTotalPrice(fast=0), 0)
+    self.assertEquals(order.getTotalPrice(fast=1), 0)
+
+    self.assertEquals(order_line.getTotalQuantity(fast=0), 4)
+    self.assertEquals(order_line.getTotalQuantity(fast=1), 4)
+    self.assertEquals(order_line.getTotalPrice(fast=0), 0)
+    self.assertEquals(order_line.getTotalPrice(fast=1), 0)
+
+    self.assertEquals(cell.getTotalQuantity(), 4)
+    self.assertEquals(cell.getTotalPrice(), 0)
+
+    # restore the price on the line
+    cell.setPrice(3)
+    get_transaction().commit()
+    self.tic()
 
     # add sub_line to line, cell and line are not movements
     sub_order_line = order_line.newContent(




More information about the Erp5-report mailing list