From 5f0813a2aa53f2675a1271b35fc599daf55ed5ba Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Wed, 21 Dec 2011 18:03:14 +0530 Subject: [PATCH] [IMP]mrp_repair: Improve the test_mrp_repair.yml bzr revid: dbr@tinyerp.com-20111221123314-vcdavkfyz3b0tu2y --- addons/mrp_repair/__openerp__.py | 2 +- addons/mrp_repair/test/test_mrp_repair.yml | 83 ++-------------------- 2 files changed, 8 insertions(+), 77 deletions(-) diff --git a/addons/mrp_repair/__openerp__.py b/addons/mrp_repair/__openerp__.py index 038d7af174e..2edeeda1667 100644 --- a/addons/mrp_repair/__openerp__.py +++ b/addons/mrp_repair/__openerp__.py @@ -49,7 +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/test_mrp_repair.yml'], #'test/test_mrp_repair.yml', 'test/mrp_repair_report.yml','test/mrp_repair_cancel.yml'], 'installable': True, 'active': False, diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index ab90ee20b8c..dc7e340b9d6 100644 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -1,93 +1,24 @@ - In order to test "mrp_repair" module, I start with creating repair order, confirm it, and start repair. -- - Given that I have already stock move line created. -- - I start by creating new Repair order for "Basic PC" product. -- - !record {model: mrp.repair, id: mrp_repair_rma0}: - address_id: base.res_partner_address_1 - guarantee_limit: !eval datetime.today().strftime("%Y-%m-%d") - invoice_method: 'after_repair' - partner_invoice_id: base.res_partner_address_1 - location_dest_id: stock.stock_location_14 - location_id: stock.stock_location_14 - move_id: 'stock_move_pcbasicpc0' - name: RMA00004 - operations: - - location_dest_id: stock.location_production - location_id: stock.stock_location_stock - name: '[HDD1] HDD Seagate 7200.8 80GB' - price_unit: 50.0 - product_id: product.product_product_hdd1 - product_uom: product.product_uom_unit - product_uom_qty: 1.0 - state: draft - to_invoice: 1 - type: add - fees_lines: - - name: 'HDD1 Seagate repair fees' - product_id: product.product_product_hdd1 - product_uom_qty: 1.0 - product_uom: product.product_uom_unit - price_unit: 50.0 - partner_id: base.res_partner_9 - product_id: product.product_product_pc1 -- - On change of product sets some values -- - !python {model: mrp.repair}: | - self.onchange_product_id(cr, uid, [ref('mrp_repair_rma0')], product_id=False) -- - On change of move id sets values of guarantee limit, source location, destination location, partner and partner address. -- - !python {model: mrp.repair}: | - repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0] - self.onchange_move_id(cr, uid, [ref('mrp_repair_rma0')], False, repair_id.move_id) -- - On change of operation type it sets source location, destination location and to invoice field -- - !python {model: mrp.repair.line}: | - self.onchange_operation_type(cr, uid, [ref('mrp_repair_rma0')], type, False, ref('base.main_company'), {}) -- - On change of partner sets the values of partner address, partner invoice address and pricelist. -- - !python {model: mrp.repair}: | - repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0] - self.onchange_partner_id(cr, uid, [ref('mrp_repair_rma0')], False, repair_id.address_id) -- - On change of production lot sets the values of source location, destination location, move and guarantee limit -- - !python {model: mrp.repair}: | - repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0] - self.onchange_lot_id(cr, uid, [ref('mrp_repair_rma0')], False, repair_id.product_id) -- - I check that Repair order is in "Draft" state. -- - !assert {model: mrp.repair, id: mrp_repair_rma0}: - - state == 'draft' - I confirm This Repair order. - - !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma0} - + !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rmrp0} - I start the repairing process by click on "Start Repair" Button For Invoice Type After repair. - - !workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rma0} - + !workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rmrp0} - I check that state is "Under Repair". - - !assert {model: mrp.repair, id: mrp_repair_rma0}: + !assert {model: mrp.repair, id: mrp_repair_rmrp0}: - state == 'under_repair' - Repairing Process for product is Done and I End Repair process by click on "End Repair" button. - - !workflow {model: mrp.repair, action: action_repair_end, ref: mrp_repair_rma0} - + !workflow {model: mrp.repair, action: action_repair_end, ref: mrp_repair_rmrp0} - - I select invoiced after repair option in this "RMA00004" Repair order. + I define invoiced after repair option in this Repair order. so I create Invoice by click on "Make Invoice" wizard. - !record {model: mrp.repair.make_invoice, id: mrp_repair_make_invoice_0}: @@ -96,10 +27,10 @@ I click on "Create Invoice" button of this wizard to make invoice. - !python {model: mrp.repair.make_invoice}: | - self.make_invoices(cr, uid, [ref("mrp_repair_make_invoice_0")], {"active_ids": [ref("mrp_repair.mrp_repair_rma0")]}) + self.make_invoices(cr, uid, [ref("mrp_repair_make_invoice_0")], {"active_ids": [ref("mrp_repair.mrp_repair_rmrp0")]}) - I check that Invoice is created for this repair order. - !python {model: mrp.repair}: | - repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0] + 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")