From 0940fbaaec126231c5faf3ede565eb95c7b2a991 Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Wed, 21 Dec 2011 18:27:53 +0530 Subject: [PATCH] [IMP]mrp_repair: Improve with different invoice_method bzr revid: dbr@tinyerp.com-20111221125753-c70p3864j1dy36qh --- addons/mrp_repair/__openerp__.py | 3 +- addons/mrp_repair/test/mrp_repair_report.yml | 2 +- addons/mrp_repair/test/test_mrp_repair.yml | 87 +++++++++++++++++++- 3 files changed, 87 insertions(+), 5 deletions(-) diff --git a/addons/mrp_repair/__openerp__.py b/addons/mrp_repair/__openerp__.py index 2edeeda1667..f211f7437ad 100644 --- a/addons/mrp_repair/__openerp__.py +++ b/addons/mrp_repair/__openerp__.py @@ -49,8 +49,7 @@ The aim is to have a complete module to manage all products repairs. The followi 'mrp_repair_report.xml', ], 'demo_xml': ['mrp_repair_demo.xml'], - 'test': ['test/test_mrp_repair.yml'], - #'test/test_mrp_repair.yml', 'test/mrp_repair_report.yml','test/mrp_repair_cancel.yml'], + 'test': ['test/test_mrp_repair.yml', 'test/mrp_repair_report.yml'], 'installable': True, 'active': False, 'certificate': '0060814381277', diff --git a/addons/mrp_repair/test/mrp_repair_report.yml b/addons/mrp_repair/test/mrp_repair_report.yml index cc6600c6704..3b8e05108c8 100644 --- a/addons/mrp_repair/test/mrp_repair_report.yml +++ b/addons/mrp_repair/test/mrp_repair_report.yml @@ -3,6 +3,6 @@ - !python {model: mrp.repair}: | import netsvc, tools, os - (data, format) = netsvc.LocalService('report.repair.order').create(cr, uid, [ref('mrp_repair.mrp_repair_rma0')], {}, {}) + (data, format) = netsvc.LocalService('report.repair.order').create(cr, uid, [ref('mrp_repair.mrp_repair_rmrp0')], {}, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'mrp_repair-order_report.'+format), 'wb+').write(data) diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index dc7e340b9d6..83ee0e96ee5 100644 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -1,7 +1,7 @@ - - In order to test "mrp_repair" module, I start with creating repair order, confirm it, and start repair. + In order to test "mrp_repair" module, I start from confirm it, and start repair. - - I confirm This Repair order. + I confirm Repair order. - !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rmrp0} - @@ -34,3 +34,86 @@ !python {model: mrp.repair}: | repair_id = self.browse(cr, uid, [ref('mrp_repair_rmrp0')], context=context)[0] assert repair_id.invoice_id.id, _("No invoice exists for this repair order") +- + I start by creating new copy Repair order for "Basic PC" product. +- + !python {model: mrp.repair}: | + copy_id = self.copy(cr, uid, ref("mrp_repair_rmrp0")) + context.update({'new_id':copy_id}) +- + I update the Invoice Method is "No Invoice" and confirm it. +- + !python {model: mrp.repair}: | + import netsvc + new_id = context.get('new_id') + self.write(cr, uid, [new_id], {'invoice_method': 'none'}) + wf_service = netsvc.LocalService("workflow") + wf_service.trg_validate(uid, 'mrp.repair', new_id, 'repair_confirm', cr) +- + I Cancel this Repair order. +- + !python {model: mrp.repair.cancel}: | + new_id = context.get('new_id') + context.update({"active_model":"mrp.repair", "active_ids": [new_id],"active_id": new_id}) + self.fields_view_get(cr, uid, False, "form", context) + self.cancel_repair(cr, uid, [new_id], context) +- + I check that Repair order is in "Cancel" state. +- + !python {model: mrp.repair}: | + new_id = context.get('new_id') + order = self.browse(cr, uid, [new_id])[0] + assert order.state == 'cancel',"Repair order should be in Cancel state." +- + I Reopen the repair order as new. +- + !python {model: mrp.repair}: | + new_id = context.get('new_id') + self.action_cancel_draft(cr, uid, [new_id]) +- + I change the Invoice method of the repair order to Before repair and confirm it again. +- + !python {model: mrp.repair}: | + import netsvc + new_id = context.get('new_id') + self.write(cr, uid, [new_id], {'invoice_method': 'b4repair'}) + wf_service = netsvc.LocalService("workflow") + wf_service.trg_validate(uid, 'mrp.repair', new_id, 'repair_confirm', cr) +- + Repair order state to 'Ready'. +- + !python {model: mrp.repair}: | + new_id = context.get('new_id') + self.action_repair_ready(cr, uid, [new_id], context) +- + I click on "Create Invoice" button of this wizard to make invoice. +- + !python {model: mrp.repair}: | + import netsvc + new_id = context.get('new_id') + wf_service = netsvc.LocalService("workflow") + wf_service.trg_validate(uid, 'mrp.repair', new_id, 'action_invoice_create', cr) +- + I check that Invoice is created for this repair order. +- + !python {model: mrp.repair}: | + new_id = context.get('new_id') + repair_id = self.browse(cr, uid, [new_id], context)[0] + assert repair_id.invoice_id.id, _("No invoice exists for this repair order.") +- + I start the repairing process by click on "Start Repair" Button. +- + !python {model: mrp.repair}: | + import netsvc + new_id = context.get('new_id') + wf_service = netsvc.LocalService("workflow") + wf_service.trg_validate(uid, 'mrp.repair', new_id, 'action_repair_start', cr) +- + Repairing Process for product is Done and I End Repair process by click on "End Repair" button For Invoice Type b4repair. +- + !python {model: mrp.repair}: | + import netsvc + new_id = context.get('new_id') + wf_service = netsvc.LocalService("workflow") + wf_service.trg_validate(uid, 'mrp.repair', new_id, 'action_repair_end', cr) +