[merge]
[odoo/odoo.git] / addons / event / test / test_event.yml
1 - |
2   In order to test the 'event' module in OpenERP, we create a new event.
3   
4 - |
5   Given that I have product "Ticket for Concert".
6
7   !record {model: product.product, id: product_product_ticketforconcert0}:
8     categ_id: product.cat1
9     cost_method: standard
10     list_price: 68.0
11     mes_type: fixed
12     name: Ticket for Concert
13     procure_method: make_to_stock
14     standard_price: 15.0
15     supply_method: buy
16     type: product
17     uom_id: product.product_uom_unit
18     uom_po_id: product.product_uom_unit
19     volume: 0.0
20     warranty: 0.0
21     weight: 0.0
22     weight_net: 0.0
23   
24 - |
25   Given that I have also Event type "Conference".
26 -   
27   !record {model: event.type, id: event_type_conference0}:
28      name: Conference
29 - |
30   I create partner "Mark Johnson" and and I provide an address to this
31    new customer, as well as an email "info@mycustomer.com".
32
33   !record {model: res.partner, id: res_partner_markjohnson0}:
34     address:
35       - city: Bruxelles
36         country_id: base.be
37         job_ids:
38           - contact_id: base_contact.res_partner_contact_jacot0
39             function: CTO
40             name: base.res_partner_maxtor
41             sequence_partner: 0.0
42             state: current
43         street: Rue des Palais 51, bte 33
44         type: default
45         zip: '1000'
46         email: 'info@mycustomer.com'
47     credit_limit: 0.0
48     lang: en_US
49     name: Mark Johnson
50     property_account_payable: account.a_pay
51     property_account_receivable: account.a_recv
52     
53 - |
54   we create it with a "Conference on OpenERP Offshore Business" event and provide "Beginning date", "Ending Date" and  "Product" as Concert Ticket.
55 -
56   !record {model: event.event, id: event_event_conference0}:
57     code: C/004
58     date_begin: '2010-06-07 13:39:00'
59     date_end: '2010-06-10 13:39:00'
60     name: Conference on OpenERP Offshore Business.
61     product_id: 'product_product_ticketforconcert0'
62     register_max: 0.0
63     register_min: 0.0
64     state: draft
65     type: 'event_type_conference0'
66     reply_to: 'info@customer.com'
67
68 - |
69   we  set the limit of registrations to this event using "Minimum Registrations"  2 and "Maximum Registrations" 10. 
70 -   
71   !python {model: event.event}: |
72     self.write(cr, uid, [ref('event_event_conference0')], {'register_max': 10, 'register_min': 2})
73     
74 - |
75   We Check that the event is in "Draft" state.
76
77   !assert {model: event.event, id: event_event_conference0}:
78      - state == 'draft'
79    
80 - |
81   Then we confirm it press on "Confirm Event" button.
82 -  
83   !python {model: event.event}: |
84     self.button_confirm(cr, uid, [ref("event_event_conference0")], {"active_ids": [ref("event.menu_event_event")]})
85     
86 - |
87   Check that Event is "confirmed" or not. 
88 -   
89   !assert {model: event.event, id: event_event_conference0}:
90      - state == 'confirm'
91      
92 - |
93   person "Mark Johnson" want to  confirm their registrations. for that 
94   I create New Registration for "Conference on OpenERP Offshore Business. 
95
96   !record {model: event.registration, id: event_registration_registrationjacot0}:
97     badge_name: Jacot
98     badge_partner: Mark Johnson
99     contact_id: base_contact.res_partner_contact_jacot0
100     date_deadline: '2010-06-07 13:39:00'
101     event_id: event.event_event_conference0
102     event_product: Ticket for Concert
103     name: 'Registration: Jacot'
104     partner_id: 'res_partner_markjohnson0'
105     partner_invoice_id: 'res_partner_markjohnson0'
106     unit_price: 68.0
107 - |
108   I check that "Number of registration" is less than "Maximum registration" defined in "Conference on OpenERP Offshore Business" event.
109   if not then  confirmation will fail because its greater  then the Maximum registration.   
110
111   !python {model: event.event}: |
112      from tools.translate import _
113      obj_register = self.pool.get('event.registration')
114      event_id1 = self.browse(cr, uid, ref('event_event_conference0'))
115      register_ids = obj_register.search(cr, uid, [('event_id', '=', event_id1.id)])
116      register_id = obj_register.browse(cr, uid, register_ids)[0]
117      assert register_id.nb_register <= event_id1.register_max, _('NO. of Registration for this event is More than Maximum Registration Defined !')
118       
119           
120 - |
121   And Confirm that Registration by click on "Confirm Registration" button of Registraion form.     
122
123   !python {model: event.registration}: |
124     self.check_confirm(cr, uid, [ref("event_registration_registrationjacot0")], {"active_ids": [ref("event.menu_action_registration")]})
125
126 - |
127   one other Person "Zen" also want to confirm their Registraions. so
128   They create New registraion for This event.
129
130   !record {model: event.registration, id: event_registration_registrationzen0}:
131     badge_name: Zen
132     badge_partner: China Export
133     contact_id: base_contact.res_partner_contact_zen0
134     date_deadline: '2010-06-07 13:39:00'
135     event_id: event.event_event_conference0
136     event_product: Ticket for Concert
137     name: 'Registration: Zen'
138     partner_id: base.res_partner_3
139     partner_invoice_id: base.res_partner_3
140     unit_price: 68.0
141     
142 - |
143   And Confirm that Registration by click on "Confirm Registration" button of Registraion form.     
144
145   !python {model: event.registration}: |
146     self.check_confirm(cr, uid, [ref("event_registration_registrationzen0")], {"active_ids": [ref("event.menu_action_registration")]})
147
148 - |
149   Third person create New Registration for "Conference on OpenERP Offshore Business" event. 
150
151   !record {model: event.registration, id: event_registration_registrationpassot0}:
152     badge_name: Passot
153     badge_partner: Mediapole SPRL
154     contact_id: base_contact.res_partner_contact_passot0
155     date_deadline: '2010-06-07 13:39:00'
156     email_from: info@mediapole.net
157     event_id: 'event_event_conference0'
158     event_product: Ticket for Concert
159     name: 'Registration: Passot'
160     partner_id: base.res_partner_8
161     partner_invoice_id: base.res_partner_8
162     unit_price: 68.0
163 - |
164   This person cannot Confirm their registration.so I check that state is "Unconfirmed".     
165
166   !assert {model: event.registration, id: event_registration_registrationpassot0}:
167      - state == 'draft'
168   
169 - |
170   I Check that  the total number of confirmed is 2 and  unconfirmed registrations 1.    
171 -
172   !python {model: event.event}: |
173      from tools.translate import _
174      obj_event = self.browse(cr, uid, ref('event_event_conference0'))
175      assert  obj_event.register_current == 2, "Number of Confirmed Registration for this event is %s"%(obj_event.register_current)
176      assert obj_event.register_prospect == 1, "Number of Unconfirmed  Registration for this event is %s" %(obj_event.register_prospect)
177 - |
178   This event is finished by click on "Event Done" button of this event form.
179
180   !python {model: event.event}: |
181     self.button_done(cr, uid, [ref("event.event_event_conference0")], {"active_ids": [ref("event.menu_event_event")] })
182 - |
183   We can create invoice if the registration is in "Open" state otherwise it gives the warning to the user.
184   so I check that Registration is in "Open" state before click on "Make Invoices."
185
186   !assert {model: event.registration, id: event_registration_registrationjacot0}: 
187      - state == 'open'  
188 - |
189   Now, I will invoice the participant who have address using "Make Invoices".Create invoice will be linked to Invoice Field available on Payments tab of registrations.
190
191
192   !record {model: event.make.invoice, id: event_make_invoice_0}:
193     {}
194 - |
195   I click on "Done" button of this "Make Invoices" wizard.
196
197   !python {model: event.make.invoice}: |
198     self.make_invoice(cr, uid, [ref("event_make_invoice_0")], {"active_ids": [ref("event_registration_registrationzen0")]})  
199 - |
200   I check  that Invoice for this partner is created or not.
201 -
202   !python {model: event.registration}: |
203      from tools.translate import _
204      data_event_reg = self.browse(cr, uid, ref('event_registration_registrationzen0'), context=context)
205      assert data_event_reg.invoice_id, _("Invoices has not been generated for this partner")