Commit f4d2f2f5 authored by Jérome Perrin's avatar Jérome Perrin

tests the case of an order line containing another order line where price is...

tests the case of an order line containing another order line where price is not set (getPrice() returns None)
getTotalPrice should return 0 in that case.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21206 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 06858d0f
......@@ -2075,6 +2075,38 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
self.assertEquals(sub_order_line.getTotalPrice(fast=0), 20)
self.assertEquals(sub_order_line.getTotalPrice(fast=1), 20)
# if this line has no price, getTotalPrice returns 0
sub_order_line.setPrice(None)
get_transaction().commit()
self.tic()
self.assertEquals(order_line.isMovement(), False)
self.assertEquals(cell.isMovement(), False)
self.assertEquals(sub_order_line.isMovement(), True)
self.assertEquals(order.getTotalQuantity(fast=0), 5)
self.assertEquals(order.getTotalQuantity(fast=1), 5)
self.assertEquals(order.getTotalPrice(fast=0), 0)
self.assertEquals(order.getTotalPrice(fast=1), 0)
self.assertEquals(order_line.getTotalQuantity(fast=0), 5)
self.assertEquals(order_line.getTotalQuantity(fast=1), 5)
self.assertEquals(order_line.getTotalPrice(fast=0), 0)
self.assertEquals(order_line.getTotalPrice(fast=1), 0)
self.assertEquals(cell.getTotalQuantity(), 0)
self.assertEquals(cell.getTotalPrice(), 0)
self.assertEquals(sub_order_line.getTotalQuantity(fast=0), 5)
self.assertEquals(sub_order_line.getTotalQuantity(fast=1), 5)
self.assertEquals(sub_order_line.getTotalPrice(fast=0), 0)
self.assertEquals(sub_order_line.getTotalPrice(fast=1), 0)
# restore price on the sub line
sub_order_line.setPrice(4)
get_transaction().commit()
self.tic()
# add sub_cell to sub_line, only sub_cell is movement
sub_order_line.setVariationCategoryList(order_line_vcl)
sub_cell_key = sub_order_line.getCellKeyList(base_id=base_id)[0]
......
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