[IMP] event:

* Added Demo data for partner Registration for event
* Added case Group of invoice for same partner

bzr revid: ron@tinyerp.com-20111115063719-22r1hsqa9tsh111d
This commit is contained in:
ron@tinyerp.com 2011-11-15 12:07:19 +05:30
parent 2452caff08
commit 6bc804ac73
2 changed files with 33 additions and 1 deletions

View File

@ -128,5 +128,16 @@
<function model="event.registration" name="check_confirm" eval="[ref('reg_0_1')]"/>
<record id="reg_0_2" model="event.registration">
<field name="event_id" ref="event_2"/>
<field name="partner_id" ref="base.res_partner_c2c"/>
<field name="partner_invoice_id" ref="base.res_partner_c2c"/>
<field name="nb_register">5</field>
<field name="event_product">Ticket for Conference</field>
<field name="unit_price">20</field>
</record>
<function model="event.registration" name="check_confirm" eval="[ref('reg_0_2')]"/>
</data>
</openerp>

View File

@ -25,4 +25,25 @@
assert record.invoice_id.type == 'out_invoice', "Invoice type is not correct"
assert record.invoice_id.origin == record.event_product, "Invoice origin is not correct"
assert record.invoice_id.amount_total == record.price_subtotal, "Invoice amount is not correct"
assert record.state == "done", "Registration should be closed after invoice generated"
assert record.state == "done", "Registration should be closed after invoice generated"
-
Now I check for same partner registration for two diffrent event and I create group invoices for same partner.
-
!python {model: event.make.invoice}: |
context.update({'active_model': 'event.make.invoice', 'active_ids': [ref("reg_0_1"), ref("reg_0_2")], 'active_id': ref("reg_0_1")})
invoice = self.create(cr, uid, {'grouped': True}, context=context)
self.make_invoice(cr, uid, [invoice], context=context)
-
Now I Check for group Invoice is created with total amount of both registration
and Registration should be closed after invoice generated.
-
!python {model: event.registration}: |
reg_data_1 = self.browse(cr, uid, [ref("reg_0_1")])[0]
reg_data_2 = self.browse(cr, uid, [ref("reg_0_2")])[0]
assert reg_data_1.invoice_id, "Invoice should be generated"
assert reg_data_1.invoice_id.state == "draft", "Invoice state should be draft"
assert reg_data_1.invoice_id.partner_id == reg_data_1.partner_id, "Customer is not correspond with registration"
assert reg_data_1.invoice_id.type == 'out_invoice', "Invoice type is not correct"
assert reg_data_1.invoice_id.origin == reg_data_1.event_product, "Invoice origin is not correct"
assert reg_data_1.invoice_id.amount_total == (reg_data_1.price_subtotal + reg_data_2.price_subtotal), "Invoice total amount is not correct"
assert reg_data_1.state == "done", "Registration should be closed after invoice generated"