Commit 431d2526 authored by Jérome Perrin's avatar Jérome Perrin

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



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21184 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8c9682b6
...@@ -2018,6 +2018,33 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2018,6 +2018,33 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
self.assertEquals(cell.getTotalQuantity(), 4) self.assertEquals(cell.getTotalQuantity(), 4)
self.assertEquals(cell.getTotalPrice(), 12) 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 # add sub_line to line, cell and line are not movements
sub_order_line = order_line.newContent( sub_order_line = order_line.newContent(
portal_type=self.order_line_portal_type, portal_type=self.order_line_portal_type,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment