summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Pineux <api@openerp.com>2012-11-05 14:55:48 +0100
committerArnaud Pineux <api@openerp.com>2012-11-05 14:55:48 +0100
commit276e70e3ba6cb90c19c03fa27786340db5dcce65 (patch)
tree6f94f88088ca78a6a42663eaa462489c8b3f2248
parent48937ea6afb023fd612b3499c46644fc53337068 (diff)
Lunch
bzr revid: api@openerp.com-20121105135548-nfrnj63a01tz61y9
-rw-r--r--addons/lunch/tests/test_lunch.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/addons/lunch/tests/test_lunch.py b/addons/lunch/tests/test_lunch.py
index d2bfb9eef0f..128e4796611 100644
--- a/addons/lunch/tests/test_lunch.py
+++ b/addons/lunch/tests/test_lunch.py
@@ -53,8 +53,7 @@ class Test_Lunch(common.TransactionCase):
})
def test_00_lunch_order(self):
- """Change the state of an order line from 'new' to 'ordered'
- Check that there are no cashmove linked to that order line"""
+ """Change the state of an order line from 'new' to 'ordered'. Check that there are no cashmove linked to that order line"""
cr, uid = self.cr, self.uid
self.order_one = self.lunch_order_line.browse(cr,uid,self.new_id_order_line,context=None)
#we check that our order_line is a 'new' one and that there are no cashmove linked to that order_line:
@@ -68,8 +67,7 @@ class Test_Lunch(common.TransactionCase):
self.assertEqual(self.order_one.cashmove, [])
def test_01_lunch_order(self):
- """Change the state of an order line from 'new' to 'ordered' then to 'confirmed'
- Check that there is a cashmove linked to the order line"""
+ """Change the state of an order line from 'new' to 'ordered' then to 'confirmed'. Check that there is a cashmove linked to the order line"""
cr, uid = self.cr, self.uid
self.test_00_lunch_order()
#We receive the order so we confirm the order line so it's state will be 'confirmed'
@@ -81,3 +79,14 @@ class Test_Lunch(common.TransactionCase):
self.assertTrue(self.order_one.cashmove!=[])
self.assertTrue(self.order_one.cashmove[0].amount==-self.order_one.price)
+ def test_02_lunch_order(self):
+ """Change the state of an order line from 'confirmed' to 'cancelled' and check that the cashmove linked to that order line will be deleted"""
+ cr, uid = self.cr, self.uid
+ self.test_01_lunch_order()
+ #We have a confirmed order with its associate cashmove
+ #We execute the cancel function
+ self.order_one.cancel()
+ self.order_one = self.lunch_order_line.browse(cr,uid,self.new_id_order_line,context=None)
+ #We check that the state is cancelled and that the cashmove has been deleted
+ self.assertEqual(self.order_one.state,'cancelled')
+ self.assertTrue(self.order_one.cashmove==[]) \ No newline at end of file