[CLEAN] clean
[odoo/odoo.git] / addons / lunch / test / test_lunch.yml
1 - |
2   In order to test the Lunch module in OpenERP,
3   I will create one lunch order and then check the effect on cashboxes and cashmoves
4
5 - |
6   Given that I have a category of lunch products "Burger".
7 -
8   !record {model: lunch.category, id: lunch_category_burger0}:
9     name: Burger
10 - |
11   Given that I have a product "Club1" in this category with a price of "2.75".
12
13 -
14   !record {model: lunch.product, id: lunch_product_club1}:
15     category_id: lunch_category_burger0
16     name: Club1
17     price: 2.75
18 - |
19   Given that I have a cashbox "Employee Cashbox"
20 -
21   !record {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
22     manager: base.user_root
23     name: Employee Cashbox
24 - |
25   I create a lunch order "LU001" for the "Club1" product
26 - |
27   When I select the product "club1", the price of 2.75 is automatically proposed
28 -
29   !record {model: lunch.order, id: lunch_order_0}:
30     date: !eval time.strftime('%Y-%m-%d')
31     product: 'lunch_product_club1'
32     price: 2.75
33
34 - |
35   I check that lunch order is on draft state after having created it.
36 -
37   !assert {model: lunch.order, id: lunch_order_0}:
38     - state == 'draft'
39 - |
40   I confirm the order "LU001" using the "Confirm Order" wizard.
41 -
42   !record {model: lunch.order.confirm, id: lunch_order_confirm_0}:
43     confirm_cashbox: 'lunch_cashbox_cashbox0'
44 -
45   I click on "Confirm Order" button of this wizard.
46 -
47   !python {model: lunch.order.confirm}: |
48     self.confirm(cr, uid, [ref('lunch_order_confirm_0')], {'active_ids': [ref('lunch_order_0')]})
49
50 - |
51   I check that the Cash Moves have been generated with the right box
52   name
53 -
54   !assert {model: lunch.order, id: lunch_order_0}:
55     - cashmove.id != False
56
57 - |
58   I check that the Total on the "Employee Cashbox" is -2.75
59
60 -
61   !assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
62     - sum_remain == -2.75
63
64 - |
65   I create a new lunch order "LU002" for the "Club1" product, at another date.
66 -
67   !record {model: lunch.order, id: lunch_order_1}:
68     date: !eval "(datetime.now() + timedelta(2)).strftime('%Y-%m-%d')"
69     product: 'lunch_product_club1'
70     price: 2.75
71
72 - |
73   I confirm this order.open wizard and select "Employee Cashbox".
74 -
75   !record {model: lunch.order.confirm, id: lunch_order_confirm_1}:
76     confirm_cashbox: 'lunch_cashbox_cashbox0'
77 - |
78   Now I click on "Confirm Order" button of this wizard.
79 -
80   !python {model: lunch.order.confirm}: |
81     self.confirm(cr, uid, [ref('lunch_order_confirm_1')],  {'active_ids': [ref('lunch_order_1')]})
82
83 - |
84   I check that the Total on the "Employee Cashbox" is -5.50
85 -
86   !assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
87     - sum_remain == -5.50
88
89 - |
90   I cancel the order "LU002"
91 -
92   !record {model: lunch.order.cancel, id: lunch_order_cancel_0}:
93     {}
94 - |
95   I click on "Yes" button of this wizard for cancel order.
96
97 -
98   !python {model: lunch.order.cancel}: |
99     self.cancel(cr, uid, [ref('lunch_order_cancel_0')], {'active_ids': [ref('lunch_order_1')]})
100
101 - |
102   I test that the Cash Moves record have been removed for the order LU002.
103 -
104   !assert {model: lunch.order, id: lunch_order_1}:
105     - cashmove.id == False
106
107 - |
108   I check that the Total on the "Employee Cashbox" is -2.75
109 -
110   !assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
111     - sum_remain == -2.75
112 - |
113   I reset the "Employee Cashbox" to zero using the "Set CashBox to Zero" wizard.
114 -
115   !record {model: lunch.cashbox.clean, id: lunch_cashbox_clean_0}:
116     {}
117 -
118   Now click on "Set to Zero" button of this wizard.
119 -
120   !python {model: lunch.cashbox.clean, id: lunch_cashbox_clean_0}: |
121     self.set_to_zero(cr, uid, [ref('lunch_cashbox_clean_0')], {'active_ids': [ref('lunch_cashbox_cashbox0')]})
122
123 - |
124   I check that the Total on the "Employee Cashbox" is -5.50
125 -
126   !assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
127     - sum_remain == 0.00
128