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
6 Given that I have a category of lunch products "Burger".
8 !record {model: lunch.category, id: lunch_category_burger0}:
11 Given that I have a product "Club1" in this category with a price of "2.75".
14 !record {model: lunch.product, id: lunch_product_club1}:
15 category_id: lunch_category_burger0
19 Given that I have a cashbox "Employee Cashbox"
21 !record {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
22 manager: base.user_root
23 name: Employee Cashbox
25 I create a lunch order "LU001" for the "Club1" product
27 When I select the product "club1", the price of 2.75 is automatically proposed
29 !record {model: lunch.order, id: lunch_order_0}:
30 date: !eval time.strftime('%Y-%m-%d')
31 product: 'lunch_product_club1'
35 I check that lunch order is on draft state after having created it.
37 !assert {model: lunch.order, id: lunch_order_0}:
40 I confirm the order "LU001" using the "Confirm Order" wizard.
42 !record {model: lunch.order.confirm, id: lunch_order_confirm_0}:
43 confirm_cashbox: 'lunch_cashbox_cashbox0'
45 I click on "Confirm Order" button of this wizard.
47 !python {model: lunch.order.confirm}: |
48 self.confirm(cr, uid, [ref('lunch_order_confirm_0')], {'active_ids': [ref('lunch_order_0')]})
51 I check that the Cash Moves have been generated with the right box
54 !assert {model: lunch.order, id: lunch_order_0}:
55 - cashmove.id != False
58 I check that the Total on the "Employee Cashbox" is -2.75
61 !assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
65 I create a new lunch order "LU002" for the "Club1" product, at another date.
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'
73 I confirm this order.open wizard and select "Employee Cashbox".
75 !record {model: lunch.order.confirm, id: lunch_order_confirm_1}:
76 confirm_cashbox: 'lunch_cashbox_cashbox0'
78 Now I click on "Confirm Order" button of this wizard.
80 !python {model: lunch.order.confirm}: |
81 self.confirm(cr, uid, [ref('lunch_order_confirm_1')], {'active_ids': [ref('lunch_order_1')]})
84 I check that the Total on the "Employee Cashbox" is -5.50
86 !assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
90 I cancel the order "LU002"
92 !record {model: lunch.order.cancel, id: lunch_order_cancel_0}:
95 I click on "Yes" button of this wizard for cancel order.
98 !python {model: lunch.order.cancel}: |
99 self.cancel(cr, uid, [ref('lunch_order_cancel_0')], {'active_ids': [ref('lunch_order_1')]})
102 I test that the Cash Moves record have been removed for the order LU002.
104 !assert {model: lunch.order, id: lunch_order_1}:
105 - cashmove.id == False
108 I check that the Total on the "Employee Cashbox" is -2.75
110 !assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
111 - sum_remain == -2.75
113 I reset the "Employee Cashbox" to zero using the "Set CashBox to Zero" wizard.
115 !record {model: lunch.cashbox.clean, id: lunch_cashbox_clean_0}:
118 Now click on "Set to Zero" button of this wizard.
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')]})
124 I check that the Total on the "Employee Cashbox" is -5.50
126 !assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}: