[ADD]: event: Add yaml file for event module.

bzr revid: atp@tinyerp.co.in-20100607140610-8lxzdr736nbb3plt
This commit is contained in:
atp (Open ERP) 2010-06-07 19:36:10 +05:30
parent 48dd79e9be
commit e7de4bd665
2 changed files with 240 additions and 0 deletions

View File

@ -52,6 +52,7 @@
'wizard/event_make_invoice_view.xml',
],
'demo_xml': ['event_demo.xml'],
'test': ['test/test_event.yml'],
'installable': True,
'active': False,
'certificate': '0083059161581',

View File

@ -0,0 +1,239 @@
- |
In order to test the 'event' module in OpenERP, we create a new event.
- |
Given that I have product "Ticket for Concert".
-
!record {model: product.product, id: product_product_ticketforconcert0}:
categ_id: product.cat1
cost_method: standard
list_price: 68.0
mes_type: fixed
name: Ticket for Concert
procure_method: make_to_stock
standard_price: 15.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
- |
Given that I have also Event type "Conference".
-
!record {model: event.type, id: event_type_conference0}:
name: Conference
- |
I create partner "Mark Johnson" and and I provide an address to this
new customer, as well as an 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'
credit_limit: 0.0
lang: en_US
name: Mark Johnson
property_account_payable: account.a_pay
property_account_receivable: account.a_recv
- |
we create it with a "Conference on ERP Buisness" event and provide "Beginning date", "Ending Date", "Product" as Concert Ticket.
-
!record {model: event.event, id: event_event_conference0}:
code: C/004
date_begin: '2010-06-07 13:39:00'
date_end: '2010-06-10 13:39:00'
name: Conference on ERP Buisness
parent_id: event.case_section_event
product_id: 'product_product_ticketforconcert0'
register_max: 0.0
register_min: 0.0
state: draft
type: 'event_type_conference0'
- |
we set the limit of registrations to this event using "Minimum Registrations" 3 and "Maximum Registrations" 10
-
!python {model: event.event}: |
self.write(cr, uid, [ref('event_event_conference0')], {'register_max': 10, 'register_min': 3})
- |
We Check that the event is in "Draft" state.
-
!assert {model: event.event, id: event_event_conference0}:
- state == 'draft'
- |
Then we confirm it press on "Confirm Event" button.
-
!python {model: event.event}: |
self.button_confirm(cr, uid, [ref("event_event_conference0")], {"active_ids": [ref("event.menu_event_event")]})
- |
Check that Event is "confirmed" or not.
-
!assert {model: event.event, id: event_event_conference0}:
- state == 'confirm'
- |
person "Mark Johnson" want to confirm their registrations. for that
I create New Registration for "Conference on ERP Buisness" event.
-
!record {model: event.registration, id: event_registration_registrationjacot0}:
badge_name: Jacot
badge_partner: Mark Johnson
badge_title: M.
contact_id: base_contact.res_partner_contact_jacot0
date_deadline: '2010-06-07 13:39:00'
event_id: event.event_event_conference0
invoice_label: Ticket for Concert
name: 'Registration: Jacot'
partner_id: 'res_partner_markjohnson0'
partner_invoice_id: 'res_partner_markjohnson0'
unit_price: 68.0
- |
I check that "Number of registration" is less than "Maximum registration" defined in "Conference on ERP Buisness" event.
if not then confirmation will fail because its greater then the Maximum registration.
-
!python {model: event.event}: |
obj_register = self.pool.get('event.registration')
event_id1 = self.browse(cr, uid, [ref('event_event_conference0')])[0]
register_ids = obj_register.search(cr, uid, [('event_id', '=', event_id1.id)])
register_id = obj_register.browse(cr, uid, register_ids)[0]
assert register_id.nb_register <= event_id1.register_max
- |
And Confirm that Registration by click on "Confirm Registration" button of Registraion form.
-
!python {model: event.registration}: |
self.check_confirm(cr, uid, [ref("event_registration_registrationjacot0")], {"active_ids": [ref("event.menu_action_registration")]})
- |
one other Person "Zen" also want to confirm their Registraions. so
They create New registraion for This event.
-
!record {model: event.registration, id: event_registration_registrationzen0}:
badge_name: Zen
badge_partner: China Export
contact_id: base_contact.res_partner_contact_zen0
date_deadline: '2010-06-07 13:39:00'
event_id: event.event_event_conference0
invoice_label: Ticket for Concert
name: 'Registration: Zen'
partner_id: base.res_partner_3
partner_invoice_id: base.res_partner_3
unit_price: 68.0
- |
And Confirm that Registration by click on "Confirm Registration" button of Registraion form.
-
!python {model: event.registration}: |
self.check_confirm(cr, uid, [ref("event_registration_registrationzen0")], {"active_ids": [ref("event.menu_action_registration")]})
- |
Third person create New Registration for "Conference on ERP Business" event.
-
!record {model: event.registration, id: event_registration_registrationpassot0}:
badge_name: Passot
badge_partner: Mediapole SPRL
badge_title: M.
contact_id: base_contact.res_partner_contact_passot0
date_deadline: '2010-06-07 13:39:00'
email_from: info@mediapole.net
event_id: 'event_event_conference0'
invoice_label: Ticket for Concert
name: 'Registration: Passot'
partner_id: base.res_partner_8
partner_invoice_id: base.res_partner_8
unit_price: 68.0
- |
This person cannot Confirm their registration.so I check that state is "Unconfirmed".
-
!assert {model: event.registration, id: event_registration_registrationpassot0}:
- state == 'draft'
- |
I Check that the total number of confirmed is 2 and unconfirmed registrations 1.
-
!python {model: event.event}: |
obj_event = self.browse(cr, uid, [ref('event_event_conference0')])[0]
assert obj_event.register_current == '2'
assert obj_event.register_prospect == '1'
- |
We check all registered partners to this event using the wizard "List Register Partners".
-
!record {model: event.partners.list, id: event_partners_list_0}:
{}
-
I click on "Open Partners" button of "List Register Partners" wizard.
-
!python {model: event.partners.list}: |
self.list_partners(cr, uid, [ref("event_partners_list_0")], {"active_ids":
[ref("event.event_event_conference0")]})
- |
We check all registrations on current event using the wizard "Registrations"
-
!record {model: event.registration.list, id: event_registration_list_0}:
{}
- |
I click on "Open Registrations" button of "Registrations" wizard.
-
!python {model: event.registration.list}: |
self.open_registration(cr, uid, [ref("event_registration_list_0")], {"active_ids": [ref("event.event_event_conference0")]})
- |
This event is finished by click on "Event Done" button of this event form.
-
!python {model: event.event}: |
self.button_done(cr, uid, [ref("event.event_event_conference0")], {"active_ids": [ref("event.menu_event_event")] })
- |
We can create invoice if the registration is in "Open" state otherwise it gives the warning to the user.
so I check that Registration is in "Open" state before click on "Make Invoices."
-
!assert {model: event.registration, id: event_registration_registrationjacot0}:
- state == 'open'
- |
Now, I will invoice the participant who have address using "Make Invoices". This wizard will also give the number of invoices are created and rejected.
Create invoice will be linked to Invoice Field available on Payments tab of registrations
-
!record {model: event.make.invoice, id: event_make_invoice_0}:
inv_created: '0'
inv_rej_reason: 'ID 1: Registration already has an invoice linked. \n'
inv_rejected: '1'
- |
I click on "Open" button of this "Make Invoices" wizard.
-
!python {model: event.make.invoice}: |
self.confirm(cr, uid, [ref("event_make_invoice_0")], {"active_ids": [ref("event_registration_registrationjacot0")]})
- |
I check that Invoice for this partner is create or not.
-
!python {model: event.registration}: |
obj_event_reg = self.pool.get('event.registration')
obj_lines = self.pool.get('account.invoice.line')
inv_obj = self.pool.get('account.invoice')
data_event_reg = obj_event_reg.browse(cr, uid, [ref('event_registration_registrationzen0')], context=context)[0]
invoice_ids = inv_obj.search(cr, uid, [('partner_id', '=', data_event_reg.partner_invoice_id.id)])
invoice_id = inv_obj.browse(cr, uid, invoice_ids)
if invoice_id:
line_ids = obj_lines.search(cr, uid, [('product_id', '=', data_event_reg.event_id.product_id), ('invoice_id', '=', invoice_id.id), ('price_unit', '=', data_event_reg.unit_price)])
line_id = obj_lines.browse(cr, uid, line_ids)[0]
assert line_id.product_id == data_event_reg.product_id
assert data_event_reg.partner_id == invoice_id.partner_id
assert invoice_id.address_invoice_id == data_event_reg.partner_address_id