- | In order to test the "Event Organisation" in Association system. - | I want to organize one conference event on "OpenERP Business". - | I'm creating new product "Ticket for Conference" to specify registration Cost of conference. - !record {model: product.product, id: product_product_ticketforconcert0}: categ_id: product.cat1 list_price: 68.0 name: Ticket for Conference - | I'm creating Event type "Conference". - !record {model: event.type, id: event_type_conference0}: name: Conferences - | I'm creating one Event "Conference on OpenERP Business" which will last from 1st of this month to 10th of this month. - !record {model: event.event, id: event_event_conference0}: date_begin: !eval time.strftime('%Y-%m-01') date_end: !eval time.strftime('%Y-%m-10') name: Conference on OpenERP Business. product_id: 'product_product_ticketforconcert0' type: 'event_type_conference0' reply_to: 'info@customer.com' - | Check that the new conference event is "Draft" or not. - !assert {model: event.event, id: event_event_conference0}: - state == 'draft', "Event should be in draft by default when first time created" - | Need Minimum 10 Registrations to confirm/start this Conference Event and does not allowed more than 100 Registrations. - | So I set Minimum and Maximum Registrations limit. - !python {model: event.event}: | self.write(cr, uid, [ref('event_event_conference0')], {'register_max': 100, 'register_min': 10}) - | I'm doing to confirm that conference event. - !python {model: event.event}: | self.button_confirm(cr, uid, [ref("event_event_conference0")]) - | But this conference event need minimum 10 Confirmed Registrations. so Check that Event is not "confirmed". - !assert {model: event.event, id: event_event_conference0}: - state != 'confirm', "Event should not confirmed if minimum registrations does not reached" - | "Mark Johnson" want to subscribe/join into "Conference on OpenERP Business" with 10 tickets. - | I'm creating new partner "Mark Johnson" with his email "info@mycustomer.com". - !record {model: res.partner, id: res_partner_markjohnson0}: address: - city: Bruxelles country_id: base.be job_ids: - contact_id: base_contact.res_partner_contact_jacot0 function: CTO name: base.res_partner_maxtor sequence_partner: 0.0 state: current street: Rue des Palais 51, bte 33 type: default zip: '1000' email: 'info@mycustomer.com' name: Mark Johnson - | I'm creating Registration for "Mark Johnson" on "Conference on OpenERP Business" with 10 tickets. - !record {model: event.registration, id: event_registration_registrationjacot0}: contact_id: base_contact.res_partner_contact_jacot0 event_id: event.event_event_conference0 partner_id: event.res_partner_markjohnson0 partner_invoice_id: event.res_partner_markjohnson0 event_product: Ticket for Conference unit_price: 68.0 nb_register: 10 - | I'm going to Open that Registration. - !python {model: event.registration}: | self.check_confirm(cr, uid, [ref("event_registration_registrationjacot0")]) - | Check that Registration is in "Open" state or not. - !assert {model: event.registration, id: event_registration_registrationjacot0}: - state == 'open', "Registration should be open here." - | I'm again trying to confirm that conference event. - !python {model: event.event}: | self.button_confirm(cr, uid, [ref("event_event_conference0")]) - | Now Minimum requirement of Registration is fulfil. so Check that Event is "confirmed" or not. - !assert {model: event.event, id: event_event_conference0}: - state == 'confirm', "Event should be confirmed here." - | I'm creating invoice of Registration of "Mark Johnson" on "Conference on OpenERP Business". - !python {model: event.registration}: | self.action_invoice_create(cr, uid, [ref("event_registration_registrationjacot0")]) - | Check Invoice of Registration of "Mark Johnson" is created or not. - !assert {model: event.registration, id: event_registration_registrationjacot0}: - invoice_id != False, "Invoice should be generated" - | Check Registration of "Mark Johnson" is closed or not after invoice generated. - !assert {model: event.registration, id: event_registration_registrationjacot0}: - state != 'done', "Registration should be closed after invoice generated" - | Now "Mark Johnson" want to another registration on "Conference on OpenERP Business" with 120 tickets. - | I'm creating new registration for "Mark Johnson" with 100 tickets. - !record {model: event.registration, id: event_registration_registrationzen0}: event_id: event.event_event_conference0 partner_id: event.res_partner_markjohnson0 partner_invoice_id: event.res_partner_markjohnson0 event_product: Ticket for Conference unit_price: 68.0 nb_register: 100 - | I'm going to open "Mark Johnson" registration. - !python {model: event.registration}: | self.check_confirm(cr, uid, [ref("event_registration_registrationzen0")]) - | But conference event does not allow more than 100 Registrations. so Check that registration is not in "open" state. - !assert {model: event.registration, id: event_registration_registrationzen0}: - state == 'draft', "Registration should be in draft by default." - | Now I'm modifying number of tickets of "Mark Johnson"'s registration with 90 tickets. - !python {model: event.registration}: | self.write(cr, uid, [ref("event_registration_registrationzen0")], {'nb_register': 90}) - | I'm again try to open "Mark Johnson" registration. - !python {model: event.registration}: | self.check_confirm(cr, uid, [ref("event_registration_registrationzen0")]) - | Check that registration "open" or not. - !assert {model: event.registration, id: event_registration_registrationzen0}: - state == 'open', "Registration should be open here." - | I'm closing "Conference on OpenERP Business" Conference event - !python {model: event.event}: | self.button_done(cr, uid, [ref("event_event_conference0")]) - | Check that conference is in "close" state or not. - !assert {model: event.event, id: event_event_conference0}: - state == 'done', "Registration should be Closed here."