From 0c9113d6e59c05f9e3a369eb90b7f2a70541012f Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Wed, 21 Dec 2011 17:42:03 +0530 Subject: [PATCH 1/7] [ADD]mrp_repair: add new Demo file. bzr revid: dbr@tinyerp.com-20111221121203-1wttm6jc2fhjtjwm --- addons/mrp_repair/__openerp__.py | 5 ++- addons/mrp_repair/mrp_repair_demo.xml | 45 ++++++++++++++++++++++ addons/mrp_repair/test/test_mrp_repair.yml | 13 ------- 3 files changed, 48 insertions(+), 15 deletions(-) create mode 100644 addons/mrp_repair/mrp_repair_demo.xml diff --git a/addons/mrp_repair/__openerp__.py b/addons/mrp_repair/__openerp__.py index 39f5a51e92c..038d7af174e 100644 --- a/addons/mrp_repair/__openerp__.py +++ b/addons/mrp_repair/__openerp__.py @@ -48,8 +48,9 @@ The aim is to have a complete module to manage all products repairs. The followi 'mrp_repair_workflow.xml', 'mrp_repair_report.xml', ], - 'demo_xml': [], - 'test': ['test/test_mrp_repair.yml', 'test/mrp_repair_report.yml','test/mrp_repair_cancel.yml'], + 'demo_xml': ['mrp_repair_demo.xml'], + 'test': [], + #'test/test_mrp_repair.yml', 'test/mrp_repair_report.yml','test/mrp_repair_cancel.yml'], 'installable': True, 'active': False, 'certificate': '0060814381277', diff --git a/addons/mrp_repair/mrp_repair_demo.xml b/addons/mrp_repair/mrp_repair_demo.xml new file mode 100644 index 00000000000..12856397cc1 --- /dev/null +++ b/addons/mrp_repair/mrp_repair_demo.xml @@ -0,0 +1,45 @@ + + + + + + + + [PC1] Basic PC + + + + RMA00004 + + + after_repair + + + + + + + + + + + + [HDD1] HDD Seagate 7200.8 80GB + 50.0 + + + 1.0 + draft + 1 + add + + + HDD1 Seagate repair fees + + 50.0 + + + 1.0 + + + diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index 27cc94da3a8..ab90ee20b8c 100644 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -2,19 +2,6 @@ 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. -- - !record {model: stock.move, id: stock_move_pcbasicpc0}: - company_id: base.main_company - date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - date_expected: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - location_dest_id: stock.stock_location_14 - location_id: stock.stock_location_stock - name: '[PC1] Basic PC' - product_id: product.product_product_pc1 - product_qty: 1.0 - product_uom: product.product_uom_unit - product_uos_qty: 1.0 - - I start by creating new Repair order for "Basic PC" product. - From 5f0813a2aa53f2675a1271b35fc599daf55ed5ba Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Wed, 21 Dec 2011 18:03:14 +0530 Subject: [PATCH 2/7] [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") From 0940fbaaec126231c5faf3ede565eb95c7b2a991 Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Wed, 21 Dec 2011 18:27:53 +0530 Subject: [PATCH 3/7] [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) + From 3a0eb00d784ed83de60bc7eba3408657c43320f5 Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Wed, 21 Dec 2011 18:29:18 +0530 Subject: [PATCH 4/7] [RMV] mrp_repair: mrp_repair/test/mrp_repair_cancel.yml bzr revid: dbr@tinyerp.com-20111221125918-ogie2nz0ladhsgam --- addons/mrp_repair/test/mrp_repair_cancel.yml | 100 ------------------- 1 file changed, 100 deletions(-) delete mode 100644 addons/mrp_repair/test/mrp_repair_cancel.yml diff --git a/addons/mrp_repair/test/mrp_repair_cancel.yml b/addons/mrp_repair/test/mrp_repair_cancel.yml deleted file mode 100644 index 682a70fde5f..00000000000 --- a/addons/mrp_repair/test/mrp_repair_cancel.yml +++ /dev/null @@ -1,100 +0,0 @@ -- - In order to test repair orders I have created stock move line record. -- - !record {model: stock.move, id: stock_move_pcbasicpc0}: - company_id: base.main_company - date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - date_expected: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - location_dest_id: stock.stock_location_14 - location_id: stock.stock_location_stock - name: '[PC1] Basic PC' - product_id: product.product_product_pc1 - product_qty: 1.0 - product_uom: product.product_uom_unit - product_uos_qty: 1.0 - -- - I start by creating new Repair order for "Basic PC" product and Invoice Method is "No Invoice". -- - !record {model: mrp.repair, id: mrp_repair_rma2}: - address_id: base.res_partner_address_1 - guarantee_limit: !eval datetime.today().strftime("%Y-%m-%d") - invoice_method: 'none' - 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: RMA000055 - 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 -- - I confirm this Repair order. -- - !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma2} -- - I Cancel this Repair order. -- - !python {model: mrp.repair.cancel}: | - context = {"lang": 'en_US', "active_model":"mrp.repair", "active_ids": [ref("mrp_repair_rma2")], "tz": False, "active_id":ref('mrp_repair_rma2')} - self.fields_view_get(cr, uid, False, "form", context) - self.cancel_repair(cr, uid, [ref("mrp_repair_rma2")], context=context) -- - I check that Repair order is in "Cancel" state. -- - !assert {model: mrp.repair, id: mrp_repair_rma2}: - - state == 'cancel' -- - I Reopen the repair order as new. -- - !python {model: mrp.repair}: | - self.action_cancel_draft(cr, uid, [ref('mrp_repair_rma2')]) -- - I change the Invoice method of the repair order to Before repair. -- - !python {model: mrp.repair}: | - self.write(cr, uid, [ref('mrp_repair_rma2')], {'invoice_method': 'b4repair'}) -- - I confirm the Repair order again. -- - !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma2} -- - Repair order state to 'Ready'. -- - !python {model: mrp.repair}: | - self.action_repair_ready(cr, uid, [ref('mrp_repair_rma2')], context=None) -- - I click on "Create Invoice" button of this wizard to make invoice. -- - !workflow {model: mrp.repair, action: action_invoice_create, ref: mrp_repair_rma2} -- - I check that Invoice is created for this repair order. -- - !python {model: mrp.repair}: | - repair_id = self.browse(cr, uid, [ref('mrp_repair_rma2')], context=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. -- - !workflow {model: mrp.repair, action: action_repair_start, ref: mrp_repair_rma2} -- - Repairing Process for product is Done and I End Repair process by click on "End Repair" button For Invoice Type b4repair. -- - !workflow {model: mrp.repair, action: action_repair_end, ref: mrp_repair_rma2} - From e335a62857ab6efe7809d19f688a83fe22f26768 Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Thu, 22 Dec 2011 12:38:28 +0530 Subject: [PATCH 5/7] [ADD,IMP]mrp_repair: added: mrp_repair/mrp_repair_demo.yml mrp_repair/test/test_mrp_repair_afterinv.yml mrp_repair/test/test_mrp_repair_b4inv.yml mrp_repair/test/test_mrp_repair_cancel.yml mrp_repair/test/test_mrp_repair_noneinv.yml modified: mrp_repair/__openerp__.py bzr revid: dbr@tinyerp.com-20111222070828-12w2d6csvranc386 --- addons/mrp_repair/__openerp__.py | 8 +- addons/mrp_repair/mrp_repair_demo.yml | 123 ++++++++++++++++++ addons/mrp_repair/test/test_mrp_repair.yml | 119 ----------------- .../test/test_mrp_repair_afterinv.yml | 37 ++++++ .../mrp_repair/test/test_mrp_repair_b4inv.yml | 30 +++++ .../test/test_mrp_repair_cancel.yml | 28 ++++ .../test/test_mrp_repair_noneinv.yml | 27 ++++ 7 files changed, 251 insertions(+), 121 deletions(-) create mode 100644 addons/mrp_repair/mrp_repair_demo.yml delete mode 100644 addons/mrp_repair/test/test_mrp_repair.yml create mode 100644 addons/mrp_repair/test/test_mrp_repair_afterinv.yml create mode 100644 addons/mrp_repair/test/test_mrp_repair_b4inv.yml create mode 100644 addons/mrp_repair/test/test_mrp_repair_cancel.yml create mode 100644 addons/mrp_repair/test/test_mrp_repair_noneinv.yml diff --git a/addons/mrp_repair/__openerp__.py b/addons/mrp_repair/__openerp__.py index f211f7437ad..d5cd855e823 100644 --- a/addons/mrp_repair/__openerp__.py +++ b/addons/mrp_repair/__openerp__.py @@ -48,8 +48,12 @@ The aim is to have a complete module to manage all products repairs. The followi 'mrp_repair_workflow.xml', 'mrp_repair_report.xml', ], - 'demo_xml': ['mrp_repair_demo.xml'], - 'test': ['test/test_mrp_repair.yml', 'test/mrp_repair_report.yml'], + 'demo_xml': ['mrp_repair_demo.yml'], + 'test': ['test/test_mrp_repair_noneinv.yml', + 'test/test_mrp_repair_b4inv.yml', + 'test/test_mrp_repair_afterinv.yml', + 'test/test_mrp_repair_cancel.yml', + 'test/mrp_repair_report.yml'], 'installable': True, 'active': False, 'certificate': '0060814381277', diff --git a/addons/mrp_repair/mrp_repair_demo.yml b/addons/mrp_repair/mrp_repair_demo.yml new file mode 100644 index 00000000000..56aad9ae16d --- /dev/null +++ b/addons/mrp_repair/mrp_repair_demo.yml @@ -0,0 +1,123 @@ +- + !record {model: stock.move, id: stock_move_pcbasicpc0}: + company_id: base.main_company + date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") + date_expected: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") + location_dest_id: stock.stock_location_14 + location_id: stock.stock_location_stock + name: '[PC1] Basic PC' + product_id: product.product_product_pc1 + product_qty: 1.0 + product_uom: product.product_uom_unit + product_uos_qty: 1.0 +- + !record {model: mrp.repair, id: mrp_repair_rmrp1}: + address_id: base.res_partner_address_1 + guarantee_limit: !eval datetime.today().strftime("%Y-%m-%d") + invoice_method: 'none' + 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 +- + !record {model: stock.move, id: stock.stock_move_stockmvmrp1}: + company_id: base.main_company + date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") + date_expected: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") + location_dest_id: stock.stock_location_14 + location_id: stock.stock_location_stock + name: '[PC3] Medium PC' + product_id: product.product_product_pc3 + product_qty: 1.0 + product_uom: product.product_uom_unit + product_uos_qty: 1.0 +- + !record {model: mrp.repair, id: mrp_repair_rmrp0}: + 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.stock_move_stockmvmrp1' + name: RMA-00007 + operations: + - location_dest_id: stock.location_production + location_id: stock.stock_location_stock + name: '[HDD2] HDD Seagate 7200.8 120GB' + price_unit: 50.0 + product_id: product.product_product_hdd2 + product_uom: product.product_uom_unit + product_uom_qty: 1.0 + state: draft + to_invoice: 1 + type: add + fees_lines: + - name: 'HDD2 Seagate repair fees' + product_id: product.product_product_hdd2 + 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_pc3 +- + !record {model: stock.move, id: stock.stock_move_stockmvmrp2}: + company_id: base.main_company + date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") + date_expected: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") + location_dest_id: stock.stock_location_14 + location_id: stock.stock_location_stock + name: '[PC4] Customizable PC' + product_id: product.product_product_pc4 + product_qty: 1.0 + product_uom: product.product_uom_unit + product_uos_qty: 1.0 +- + !record {model: mrp.repair, id: mrp_repair_rmrp2}: + address_id: base.res_partner_address_1 + guarantee_limit: !eval datetime.today().strftime("%Y-%m-%d") + invoice_method: 'b4repair' + partner_invoice_id: base.res_partner_address_1 + location_dest_id: stock.stock_location_14 + location_id: stock.stock_location_14 + move_id: 'stock.stock_move_stockmvmrp2' + name: RMA-00011 + operations: + - location_dest_id: stock.location_production + location_id: stock.stock_location_stock + name: '[HDD3] HDD Seagate 7200.8 160GB' + price_unit: 50.0 + product_id: product.product_product_hdd3 + product_uom: product.product_uom_unit + product_uom_qty: 1.0 + state: draft + to_invoice: 1 + type: add + fees_lines: + - name: 'HDD3 Seagate repair fees' + product_id: product.product_product_hdd3 + 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_pc4 diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml deleted file mode 100644 index 83ee0e96ee5..00000000000 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ /dev/null @@ -1,119 +0,0 @@ -- - In order to test "mrp_repair" module, I start from confirm it, and start repair. -- - I confirm Repair order. -- - !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_rmrp0} -- - I check that state is "Under Repair". -- - !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_rmrp0} -- - 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}: - group: 1 -- - 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_rmrp0")]}) -- - I check that Invoice is created for this repair order. -- - !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) - diff --git a/addons/mrp_repair/test/test_mrp_repair_afterinv.yml b/addons/mrp_repair/test/test_mrp_repair_afterinv.yml new file mode 100644 index 00000000000..313bbabf292 --- /dev/null +++ b/addons/mrp_repair/test/test_mrp_repair_afterinv.yml @@ -0,0 +1,37 @@ +- + In order to test invoice type after repair. +- + I Confirm Repair order For Invoice Type After repair. +- + !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_rmrp0} +- + I check that state is "Under Repair". +- + !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_rmrp0} +- + 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}: + group: 1 +- + 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_rmrp0")]}) +- + I check that Invoice is created for this repair order. +- + !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") + diff --git a/addons/mrp_repair/test/test_mrp_repair_b4inv.yml b/addons/mrp_repair/test/test_mrp_repair_b4inv.yml new file mode 100644 index 00000000000..1e7b148cc3c --- /dev/null +++ b/addons/mrp_repair/test/test_mrp_repair_b4inv.yml @@ -0,0 +1,30 @@ +- + Now test invoice type before repair. +- + I Confirm Repair order For Invoice Type Before Repair. +- + !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rmrp2} +- + Repair order state to 'Ready'. +- + !python {model: mrp.repair}: | + self.action_repair_ready(cr, uid, [ref('mrp_repair_rmrp2')], context=None) +- + I click on "Create Invoice" button of this wizard to make invoice. +- + !workflow {model: mrp.repair, action: action_invoice_create, ref: mrp_repair_rmrp2} +- + I check that Invoice is created for this repair order. +- + !python {model: mrp.repair}: | + repair_id = self.browse(cr, uid, [ref('mrp_repair_rmrp2')], context=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. +- + !workflow {model: mrp.repair, action: action_repair_start, ref: mrp_repair_rmrp2} +- + Repairing Process for product is Done and I End Repair process by click on "End Repair" button For Invoice Type b4repair. +- + !workflow {model: mrp.repair, action: action_repair_end, ref: mrp_repair_rmrp2} + diff --git a/addons/mrp_repair/test/test_mrp_repair_cancel.yml b/addons/mrp_repair/test/test_mrp_repair_cancel.yml new file mode 100644 index 00000000000..c9cde833907 --- /dev/null +++ b/addons/mrp_repair/test/test_mrp_repair_cancel.yml @@ -0,0 +1,28 @@ +- + In order to test the cancel floe of mrp_repair module, + 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_rmrp1")) + context.update({'new_id':copy_id}) +- + 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]) diff --git a/addons/mrp_repair/test/test_mrp_repair_noneinv.yml b/addons/mrp_repair/test/test_mrp_repair_noneinv.yml new file mode 100644 index 00000000000..481f86431ba --- /dev/null +++ b/addons/mrp_repair/test/test_mrp_repair_noneinv.yml @@ -0,0 +1,27 @@ +- + In order to test "mrp_repair" module, I start from confirm it, and start repair. +- + I Confirm Repair order for Invoice Type 'None'. +- + !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rmrp1} +- + I start the repairing process by click on "Start Repair" Button For Invoice Type None. +- + !workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rmrp1} +- + I check that state is "Under Repair". +- + !assert {model: mrp.repair, id: mrp_repair_rmrp1}: + - 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_rmrp1} +- + I define invoiced none option in this Repair order. + So, I check that Invoice should not be created for this repair order. +- + !python {model: mrp.repair}: | + repair_id = self.browse(cr, uid, [ref('mrp_repair_rmrp1')], context=context)[0] + assert not repair_id.invoice_id.id, _("Invoice should not be exists for this repair order") + From 12ab693737d517b55e3ae10ba85880abfd7cd02f Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Thu, 22 Dec 2011 13:26:48 +0530 Subject: [PATCH 6/7] [RMV]mrp_repair: Delete the demo.xml bzr revid: dbr@tinyerp.com-20111222075648-6h2yrn9o4r7fvcnq --- addons/mrp_repair/mrp_repair_demo.xml | 45 --------------------------- 1 file changed, 45 deletions(-) delete mode 100644 addons/mrp_repair/mrp_repair_demo.xml diff --git a/addons/mrp_repair/mrp_repair_demo.xml b/addons/mrp_repair/mrp_repair_demo.xml deleted file mode 100644 index 12856397cc1..00000000000 --- a/addons/mrp_repair/mrp_repair_demo.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - [PC1] Basic PC - - - - RMA00004 - - - after_repair - - - - - - - - - - - - [HDD1] HDD Seagate 7200.8 80GB - 50.0 - - - 1.0 - draft - 1 - add - - - HDD1 Seagate repair fees - - 50.0 - - - 1.0 - - - From ded2d63235ef1769e757383430e6dd0ec1d64301 Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Thu, 22 Dec 2011 14:17:27 +0530 Subject: [PATCH 7/7] [IMP] improve Typo and remove extra space. bzr revid: dbr@tinyerp.com-20111222084727-34aef7zcbcc88dhv --- addons/mrp_repair/test/test_mrp_repair_afterinv.yml | 1 - addons/mrp_repair/test/test_mrp_repair_b4inv.yml | 3 +-- addons/mrp_repair/test/test_mrp_repair_cancel.yml | 2 +- addons/mrp_repair/test/test_mrp_repair_noneinv.yml | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/addons/mrp_repair/test/test_mrp_repair_afterinv.yml b/addons/mrp_repair/test/test_mrp_repair_afterinv.yml index 313bbabf292..0d4eb9b1c7c 100644 --- a/addons/mrp_repair/test/test_mrp_repair_afterinv.yml +++ b/addons/mrp_repair/test/test_mrp_repair_afterinv.yml @@ -34,4 +34,3 @@ !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") - diff --git a/addons/mrp_repair/test/test_mrp_repair_b4inv.yml b/addons/mrp_repair/test/test_mrp_repair_b4inv.yml index 1e7b148cc3c..bfe717ecdd6 100644 --- a/addons/mrp_repair/test/test_mrp_repair_b4inv.yml +++ b/addons/mrp_repair/test/test_mrp_repair_b4inv.yml @@ -24,7 +24,6 @@ - !workflow {model: mrp.repair, action: action_repair_start, ref: mrp_repair_rmrp2} - - Repairing Process for product is Done and I End Repair process by click on "End Repair" button For Invoice Type b4repair. + Repairing Process for product is Done and I End Repair process by click on "End Repair" button For Invoice Type before repair. - !workflow {model: mrp.repair, action: action_repair_end, ref: mrp_repair_rmrp2} - diff --git a/addons/mrp_repair/test/test_mrp_repair_cancel.yml b/addons/mrp_repair/test/test_mrp_repair_cancel.yml index c9cde833907..6a355f35b41 100644 --- a/addons/mrp_repair/test/test_mrp_repair_cancel.yml +++ b/addons/mrp_repair/test/test_mrp_repair_cancel.yml @@ -1,5 +1,5 @@ - - In order to test the cancel floe of mrp_repair module, + In order to test the cancel flow of mrp_repair module, I start by creating new copy Repair order for "Basic PC" product. - !python {model: mrp.repair}: | diff --git a/addons/mrp_repair/test/test_mrp_repair_noneinv.yml b/addons/mrp_repair/test/test_mrp_repair_noneinv.yml index 481f86431ba..66d5017e840 100644 --- a/addons/mrp_repair/test/test_mrp_repair_noneinv.yml +++ b/addons/mrp_repair/test/test_mrp_repair_noneinv.yml @@ -24,4 +24,4 @@ !python {model: mrp.repair}: | repair_id = self.browse(cr, uid, [ref('mrp_repair_rmrp1')], context=context)[0] assert not repair_id.invoice_id.id, _("Invoice should not be exists for this repair order") - +