From 622c8673194f853b29e3c654d2c6ee5f8b5e960f Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 20 Sep 2011 12:20:38 +0530 Subject: [PATCH 01/36] [IMP]:mrp operation for check cancel the MO and production order state bzr revid: ksa@tinyerp.com-20110920065038-mlcm5h5fb1zxup5f --- addons/mrp_operations/__openerp__.py | 2 +- .../test/mrp_operation_test.yml | 62 +++++++++++++++++++ addons/mrp_operations/test/mrp_operations.yml | 13 ++++ 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 addons/mrp_operations/test/mrp_operation_test.yml diff --git a/addons/mrp_operations/__openerp__.py b/addons/mrp_operations/__openerp__.py index 08f8f5b7f5b..0f1c915f62f 100644 --- a/addons/mrp_operations/__openerp__.py +++ b/addons/mrp_operations/__openerp__.py @@ -65,7 +65,7 @@ So that we can compare the theoretic delay and real delay. 'process/mrp_operation_process.xml' ], 'demo_xml': ['mrp_operation_data.xml'], - 'test': ['test/mrp_operations.yml', 'test/mrp_operations_report.yml'], + 'test': ['test/mrp_operations.yml', 'test/mrp_operations_report.yml','test/mrp_operation_test.yml'], 'installable': True, 'active': False, 'certificate': '0056233813133', diff --git a/addons/mrp_operations/test/mrp_operation_test.yml b/addons/mrp_operations/test/mrp_operation_test.yml new file mode 100644 index 00000000000..a6a5dac1670 --- /dev/null +++ b/addons/mrp_operations/test/mrp_operation_test.yml @@ -0,0 +1,62 @@ +- + In order to test mrp_operations module in OpenERP I will put a Production order + and check its effects on Work orders. +- + I create a production order. +- + !record {model: mrp.production, id: mrp_production_mo1}: + company_id: base.main_company + date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") + location_dest_id: stock.stock_location_stock + location_src_id: stock.stock_location_stock + name: MO/01234567 + product_id: product.product_product_pc1 + product_qty: 5.0 + product_uom: product.product_uom_unit + product_uos_qty: 5.0 +- + I am computing the data. +- + !python {model: mrp.production}: | + self.action_compute(cr, uid, [ref("mrp_production_mo1")], {"lang": "en_US", "tz": + False, "search_default_current": 1, "active_model": "ir.ui.menu", "active_ids": + [ref("mrp.menu_mrp_production_action")], "active_id": ref("mrp.menu_mrp_production_action"), + }) +- + Now I confirm my production order. +- + !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo1} +- + I check that there is one Work order generated related to my production order. +- + !python {model: mrp.production.workcenter.line}: | + from tools.translate import _ + order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo1')),('state','=','draft')]) + assert order_id, _('No Work order!') +- + The scheduler runs. +- + !function {model: procurement.order, name: run_scheduler}: + - model: procurement.order + search: "[('state','=','confirmed')]" +- + I am checking Internal picking. +- + !python {model: stock.picking}: | + from tools.translate import _ + pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal')]) + assert pick_ids, _('No Internal Pickings!') +- + In order to cancel the MO, I first cancel its picking +- + !python {model: stock.picking}: | + mrp_obj = self.pool.get('mrp.production') + mo = mrp_obj.browse(cr, uid, ref("mrp_production_mo1")) + picking_id = self.search(cr, uid, [('origin','like','%MO/01234567')]) + if picking_id: + self.action_cancel(cr, uid, picking_id, context=None) +- + Then I cancel The Manufacturing order. +- + !workflow {model: mrp.production, action: button_cancel, ref: mrp_production_mo1} + diff --git a/addons/mrp_operations/test/mrp_operations.yml b/addons/mrp_operations/test/mrp_operations.yml index dc193186341..af398bbc292 100644 --- a/addons/mrp_operations/test/mrp_operations.yml +++ b/addons/mrp_operations/test/mrp_operations.yml @@ -122,6 +122,19 @@ from tools.translate import _ order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','startworking')]) assert order_id, _('Work order not started yet!') +- + Modifies production order state if work order state is changed. +- + !python {model: mrp.production.workcenter.line}: | + from tools.translate import _ + prod_obj = self.pool.get('mrp.production') + order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0'))]) + order_data = self.browse(cr, uid, order_id[0]) + if order_data.production_id.state=='confirmed': + prod_obj.force_production(cr, uid, [order_data.id]) + wf_service.trg_validate(uid, 'mrp.production', order_data.id, 'button_produce', cr) + elif order_data.production_id.state=='ready': + wf_service.trg_validate(uid, 'mrp.production', order_data.id, 'button_produce', cr) - I am creating a mrp.product.produce record. - From 71f3ce44af9900109a8f4e34dec504b6c54c0f61 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 20 Sep 2011 12:29:45 +0530 Subject: [PATCH 02/36] [IMP]:check ready state for mrp operation bzr revid: ksa@tinyerp.com-20110920065945-10xkdhfhq5ybdeh7 --- addons/mrp_operations/test/mrp_operations.yml | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/addons/mrp_operations/test/mrp_operations.yml b/addons/mrp_operations/test/mrp_operations.yml index af398bbc292..c6435bca14f 100644 --- a/addons/mrp_operations/test/mrp_operations.yml +++ b/addons/mrp_operations/test/mrp_operations.yml @@ -102,8 +102,14 @@ - !python {model: mrp.production}: | from tools.translate import _ + import netsvc + wf_service = netsvc.LocalService("workflow") prod_ids = self.search(cr, uid, [('id','=',ref('mrp_production_mo0')),('state','=','ready')]) - assert prod_ids, _('Production order is not ready!') + order_data = self.browse(cr, uid, prod_ids[0]) + if order_data: + wf_service.trg_validate(uid, 'mrp.production', order_data.id, 'button_produce', cr) + else: + assert prod_ids, _('Production order is not ready!') - I check that both internal pickings are done. - @@ -122,19 +128,6 @@ from tools.translate import _ order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','startworking')]) assert order_id, _('Work order not started yet!') -- - Modifies production order state if work order state is changed. -- - !python {model: mrp.production.workcenter.line}: | - from tools.translate import _ - prod_obj = self.pool.get('mrp.production') - order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0'))]) - order_data = self.browse(cr, uid, order_id[0]) - if order_data.production_id.state=='confirmed': - prod_obj.force_production(cr, uid, [order_data.id]) - wf_service.trg_validate(uid, 'mrp.production', order_data.id, 'button_produce', cr) - elif order_data.production_id.state=='ready': - wf_service.trg_validate(uid, 'mrp.production', order_data.id, 'button_produce', cr) - I am creating a mrp.product.produce record. - From 9ca3c1c564fb78d63974159cc5c7995cc72fb218 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 20 Sep 2011 12:32:08 +0530 Subject: [PATCH 03/36] [IMP]:check related work order is inprogress state for mrp operation bzr revid: ksa@tinyerp.com-20110920070208-9exlds56ixlbcw65 --- addons/mrp_operations/test/mrp_operations.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/addons/mrp_operations/test/mrp_operations.yml b/addons/mrp_operations/test/mrp_operations.yml index c6435bca14f..4faf9b0e6d8 100644 --- a/addons/mrp_operations/test/mrp_operations.yml +++ b/addons/mrp_operations/test/mrp_operations.yml @@ -128,6 +128,19 @@ from tools.translate import _ order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','startworking')]) assert order_id, _('Work order not started yet!') +- + I check that the related work order is in progress state. +- + !python {model: mrp.production.workcenter.line}: | + from tools.translate import _ + import netsvc + wf_service = netsvc.LocalService("workflow") + order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','startworking')]) + order_data = self.browse(cr, uid, order_id[0]) + if order_data: + wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order_data.id, 'button_start_working', cr) + else: + assert order_id, _('Work order not started yet!') - I am creating a mrp.product.produce record. - From a9237c7f7d22ecd55db5d12f13ab3c9be394b3d1 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 20 Sep 2011 12:34:41 +0530 Subject: [PATCH 04/36] [ADD]: data for fees in mrp repair bzr revid: ksa@tinyerp.com-20110920070441-8uzqs8vgeplr9okk --- addons/mrp_repair/test/test_mrp_repair.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index 881ef449405..35e697aec68 100644 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -39,6 +39,11 @@ state: draft to_invoice: 1 type: add + fees_lines: + - name: 'HDD1 Seagate repair fees' + 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 From a658e048f4a4746baf6f44f579204baf01685ff2 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 20 Sep 2011 12:37:00 +0530 Subject: [PATCH 05/36] [IMP]:check missing workflow related state in mrp repair bzr revid: ksa@tinyerp.com-20110920070700-mg2hkm6mbvc2o93l --- addons/mrp_repair/test/test_mrp_repair.yml | 46 +++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index 35e697aec68..129ff431aab 100644 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -47,6 +47,38 @@ partner_id: base.res_partner_9 product_id: product.product_product_pc1 +- | + I start by creating new Repair order for "Basic Pc" product and Invoice Type b4repair. + +- + !record {model: mrp.repair, id: mrp_repair_rma1}: + 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_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_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 check that Repair order is in "Draft" state. - @@ -59,9 +91,17 @@ !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma0} - | - I start the repairing process by click on "Start Repair" Button. + I confirm This Repair order For Invoice Type b4repair. +- + !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma1} +- | + I start the repairing process by click on "Start Repair" Button For Invoice Type b4repair. - !workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rma0} +- | + I start the repairing process by click on "Start Repair" Button For Invoice Type b4repair. +- + !workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rma1} - | I check that state is "Under Repair". @@ -72,6 +112,10 @@ 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} +- | + 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_rma1} - | I select invoiced after repair option in this "RMA00004" Repair order. so I create Invoice by click on "Make Invoice" wizard. From ae021f21c21673d754f7b125837b6d5cadabcd88 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 20 Sep 2011 12:39:23 +0530 Subject: [PATCH 06/36] [IMP]:onchange for product in mrp repair bzr revid: ksa@tinyerp.com-20110920070923-mcer01g3xmzdqur8 --- addons/mrp_repair/test/test_mrp_repair.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index 129ff431aab..b932f4fe7b3 100644 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -41,6 +41,7 @@ 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 @@ -59,7 +60,7 @@ location_dest_id: stock.stock_location_14 location_id: stock.stock_location_14 move_id: 'stock_move_pcbasicpc0' - name: RMA00004 + name: RMA00005 operations: - location_dest_id: stock.location_production location_id: stock.stock_location_stock @@ -73,6 +74,7 @@ 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 @@ -138,3 +140,8 @@ invoice_id = inv_obj.browse(cr, uid, invoice_ids)[0] assert repair_id.partner_id.id == invoice_id.partner_id.id, "No invoice existing for the same partner" +- | + On change of product sets some values +- + !python {model: mrp.repair}: | + self.onchange_product_id(cr, uid, [ref('mrp_repair_rma0')], product_id=False) From 53b4bdc2a3122e3910cba2069bb34fd60b98b170 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 20 Sep 2011 12:41:52 +0530 Subject: [PATCH 07/36] [IMP]:check onchange method for mrp repair bzr revid: ksa@tinyerp.com-20110920071152-oyuf3jtcjpgp8sft --- addons/mrp_repair/test/test_mrp_repair.yml | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index b932f4fe7b3..5e391d71bfc 100644 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -145,3 +145,63 @@ - !python {model: mrp.repair}: | self.onchange_product_id(cr, uid, [ref('mrp_repair_rma0')], product_id=False) +- | + Cancels repair order. +- + !python {model: mrp.repair}: | + self.action_cancel(cr, uid, [ref('mrp_repair_rma0')], context=None) +- | + Cancels repair order when it is in 'Draft' state +- + !python {model: mrp.repair}: | + self.action_cancel_draft(cr, uid, [ref('mrp_repair_rma0')]) +- | + Writes repair order state to 'Ready'. +- + !python {model: mrp.repair}: | + self.action_repair_ready(cr, uid, [ref('mrp_repair_rma0')], context=None) +- | + Writes repair order state to 'Exception in invoice' +- + !python {model: mrp.repair}: | + self.action_invoice_cancel(cr, uid, [ref('mrp_repair_rma0')], context=None) +- | + Writes repair order state to 'Ready' if invoice method is Before repair. +- + !python {model: mrp.repair}: | + self.action_invoice_end(cr, uid, [ref('mrp_repair_rma0')], context=None) +- | + Creates stock move and picking for repair order +- + !python {model: mrp.repair}: | + self.wkf_repair_done(cr, uid, [ref('mrp_repair_rma0')]) +- | + 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] + prod_id=False + move_id=repair_id.move_id + self.onchange_move_id(cr, uid, [ref('mrp_repair_rma0')], prod_id, move_id) +- | + On change of operation type it sets source location, destination location and to invoice field +- + !python {model: mrp.repair.line}: | + guarantee_limit=False + self.onchange_operation_type(cr, uid, [ref('mrp_repair_rma0')], type, guarantee_limit) +- | + 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] + part=False + address_id=False + self.onchange_partner_id(cr, uid, [ref('mrp_repair_rma0')], part, 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] + lot=False + product_id=repair_id.product_id + self.onchange_lot_id(cr, uid, [ref('mrp_repair_rma0')], lot, product_id) From ed2f99fe34511342f63d62a18abcf9f09858badd Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 20 Sep 2011 12:49:05 +0530 Subject: [PATCH 08/36] [IMP]:check start date for stock move in mrp operation and remove unuse line in mrp repair bzr revid: ksa@tinyerp.com-20110920071905-7a9cr3l5cvwkwjh9 --- addons/mrp_operations/test/mrp_operations.yml | 13 ++++++------- addons/mrp_repair/mrp_repair.py | 2 -- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/addons/mrp_operations/test/mrp_operations.yml b/addons/mrp_operations/test/mrp_operations.yml index 4faf9b0e6d8..0b97486c2aa 100644 --- a/addons/mrp_operations/test/mrp_operations.yml +++ b/addons/mrp_operations/test/mrp_operations.yml @@ -14,6 +14,7 @@ product_qty: 5.0 product_uom: product.product_uom_unit product_uos_qty: 5.0 + allow_reorder: True - I am computing the data. - @@ -123,13 +124,6 @@ !workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0} - I check that the related work order is in progress state. -- - !python {model: mrp.production.workcenter.line}: | - from tools.translate import _ - order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','startworking')]) - assert order_id, _('Work order not started yet!') -- - I check that the related work order is in progress state. - !python {model: mrp.production.workcenter.line}: | from tools.translate import _ @@ -163,3 +157,8 @@ from tools.translate import _ order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','done')]) assert order_id, _('Work order not done yet!') +- + Calculates start date for stock moves finding interval from resource calendar. +- + !python {model: mrp.production}: | + self._move_pass(cr, uid, [ref('mrp_production_mo0')], context=None) \ No newline at end of file diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 3a538590d10..6ea2a7d01c8 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -105,8 +105,6 @@ class mrp_repair(osv.osv): return res def _get_lines(self, cr, uid, ids, context=None): - if context is None: - context = {} result = {} for line in self.pool.get('mrp.repair.line').browse(cr, uid, ids, context=context): result[line.repair_id.id] = True From 277af7274739e3a6547ffb07bc9be416b2868669 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 20 Sep 2011 12:51:44 +0530 Subject: [PATCH 09/36] [IMP]:check planned end date for production order in mrp operation bzr revid: ksa@tinyerp.com-20110920072144-v5irvw226evkt8uv --- addons/mrp_operations/test/mrp_operations.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/mrp_operations/test/mrp_operations.yml b/addons/mrp_operations/test/mrp_operations.yml index 0b97486c2aa..43a27d48994 100644 --- a/addons/mrp_operations/test/mrp_operations.yml +++ b/addons/mrp_operations/test/mrp_operations.yml @@ -161,4 +161,12 @@ Calculates start date for stock moves finding interval from resource calendar. - !python {model: mrp.production}: | - self._move_pass(cr, uid, [ref('mrp_production_mo0')], context=None) \ No newline at end of file + self._move_pass(cr, uid, [ref('mrp_production_mo0')], context=None) +- + Calculates planned end date of production order. +- + !python {model: mrp.production}: | + mo = self.browse(cr, uid, ref("mrp_production_mo0")) + prop=mo.date_planned + unknow_none=False + self._production_date_end(cr, uid, [ref("mrp_production_mo0")], prop, unknow_none, context=None) From b54962810fedd7ef86a8cb34901814df3ee0b1e8 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 20 Sep 2011 13:49:36 +0530 Subject: [PATCH 10/36] [IMP]:check for remaining state in mrp operation bzr revid: ksa@tinyerp.com-20110920081936-c0mk6714tur16nqb --- .../test/mrp_operation_test.yml | 87 ++++++++++++++++++- 1 file changed, 86 insertions(+), 1 deletion(-) diff --git a/addons/mrp_operations/test/mrp_operation_test.yml b/addons/mrp_operations/test/mrp_operation_test.yml index a6a5dac1670..593c00acedd 100644 --- a/addons/mrp_operations/test/mrp_operation_test.yml +++ b/addons/mrp_operations/test/mrp_operation_test.yml @@ -14,6 +14,19 @@ product_qty: 5.0 product_uom: product.product_uom_unit product_uos_qty: 5.0 +- + I create a production order. +- + !record {model: mrp.production, id: mrp_production_mo2}: + company_id: base.main_company + date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") + location_dest_id: stock.stock_location_stock + location_src_id: stock.stock_location_stock + name: MO/012345678 + product_id: product.product_product_pc1 + product_qty: 5.0 + product_uom: product.product_uom_unit + product_uos_qty: 5.0 - I am computing the data. - @@ -22,10 +35,22 @@ False, "search_default_current": 1, "active_model": "ir.ui.menu", "active_ids": [ref("mrp.menu_mrp_production_action")], "active_id": ref("mrp.menu_mrp_production_action"), }) +- + I am computing the data. +- + !python {model: mrp.production}: | + self.action_compute(cr, uid, [ref("mrp_production_mo2")], {"lang": "en_US", "tz": + False, "search_default_current": 1, "active_model": "ir.ui.menu", "active_ids": + [ref("mrp.menu_mrp_production_action")], "active_id": ref("mrp.menu_mrp_production_action"), + }) - Now I confirm my production order. - !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo1} +- + Now I confirm my production order. +- + !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo2} - I check that there is one Work order generated related to my production order. - @@ -59,4 +84,64 @@ Then I cancel The Manufacturing order. - !workflow {model: mrp.production, action: button_cancel, ref: mrp_production_mo1} - +- + I check that there is one Work order generated related to my production order. +- + !python {model: mrp.production.workcenter.line}: | + from tools.translate import _ + order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo2')),('state','=','draft')]) + assert order_id, _('No Work order!') +- + The scheduler runs. +- + !function {model: procurement.order, name: run_scheduler}: + - model: procurement.order + search: "[('state','=','confirmed')]" +- + I check that my production order and its related work order is in done state. +- + !python {model: mrp.production.workcenter.line}: | + from tools.translate import _ + prod_obj = self.pool.get('mrp.production') + prod_order_ids = prod_obj.search(cr, uid, [('origin','like','%MO/0123456')]) + assert prod_order_ids, _('Workorder not found') + workorder_id = self.search(cr, uid, [('production_id','=', prod_order_ids[0])]) + workorder_bro = self.browse(cr, uid, workorder_id[0]) + assert workorder_bro.state == 'done', _('Work order is not done! It is %s') % workorder_bro.state +- + Now I check my original production order is now ready. +- + !python {model: mrp.production}: | + from tools.translate import _ + import netsvc + wf_service = netsvc.LocalService("workflow") + prod_ids = self.search(cr, uid, [('id','=',ref('mrp_production_mo2')),('state','=','ready')]) + order_data = self.browse(cr, uid, prod_ids[0]) + if order_data: + wf_service.trg_validate(uid, 'mrp.production', order_data.id, 'button_produce', cr) + else: + assert prod_ids, _('Production order is not ready!') +- + I check that both internal pickings are done. +- + !python {model: stock.picking}: | + from tools.translate import _ + pick_ids = self.search(cr, uid, [('state','=','done'),('type','=','internal')]) + assert pick_ids, _('Internal pickings are not done!') +- + Now I start my first production order. +- + !workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0} +- + I check that the related work order is in progress state. +- + !python {model: mrp.production.workcenter.line}: | + from tools.translate import _ + import netsvc + wf_service = netsvc.LocalService("workflow") + order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo2')),('state','=','startworking')]) + order_data = self.browse(cr, uid, order_id[0]) + if order_data: + wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order_data.id, 'button_pause', cr) + else: + assert order_id, _('Work order not started yet!') From 245935dd958edf1c09d81ad28797c465e0c16462 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 20 Sep 2011 13:55:38 +0530 Subject: [PATCH 11/36] [IMP]: cancel the repair order bzr revid: ksa@tinyerp.com-20110920082538-49m07h6kad0h9pp3 --- addons/mrp_repair/test/test_mrp_repair.yml | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index 5e391d71bfc..655a93f1708 100644 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -205,3 +205,46 @@ lot=False product_id=repair_id.product_id self.onchange_lot_id(cr, uid, [ref('mrp_repair_rma0')], lot, product_id) +- + I start by creating new Repair order for "Basic Pc" product and Invoice Type None. +- + !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} +- + Cancel Repair order using wizard. +- + !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) \ No newline at end of file From f12c2496f625d4939bbfb6698723cb9725c91aa7 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 20 Sep 2011 13:58:28 +0530 Subject: [PATCH 12/36] [IMP]:cancel production order related with picking in mrp bzr revid: ksa@tinyerp.com-20110920082828-0rn1sscgcedp73if --- addons/mrp/test/mrp_production_order.yml | 44 ++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/addons/mrp/test/mrp_production_order.yml b/addons/mrp/test/mrp_production_order.yml index 6c1a2a4403e..386f0673ab0 100644 --- a/addons/mrp/test/mrp_production_order.yml +++ b/addons/mrp/test/mrp_production_order.yml @@ -99,3 +99,47 @@ prod_obj = self.pool.get('mrp.production') prod_ids = prod_obj.search(cr, uid, [('product_id.default_code','=','PC1')]) self.do_produce(cr, uid, [ref('mrp_product_produce1')], context={'active_ids': prod_ids}) +- + I am creating one manufacturing order. +- + !record {model: mrp.production, id: mrp_production_mo2}: + company_id: base.main_company + date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") + location_dest_id: stock.stock_location_stock + location_src_id: stock.stock_location_stock + product_id: product.product_product_pc1 + product_qty: 5.0 + product_uom: product.product_uom_unit + product_uos_qty: 0.0 +- + I compute the data. +- + !python {model: mrp.production}: | + self.action_compute(cr, uid, [ref("mrp_production_mo2")], {"lang": "en_US", "tz": + False, "search_default_current": 1, "active_model": "ir.ui.menu", "active_ids": + [ref("mrp.menu_mrp_production_action")], "active_id": ref("mrp.menu_mrp_production_action"), + }) +- + I confirm the order. +- + !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo2} +- + I am checking Internal picking. +- + !python {model: stock.picking}: | + from tools.translate import _ + pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal')]) + assert pick_ids, _('No Internal Pickings!') +- + In order to cancel the MO, I first cancel its picking. +- + !python {model: stock.picking}: | + mrp_obj = self.pool.get('mrp.production') + mo = mrp_obj.browse(cr, uid, ref("mrp_production_mo2")) + picking_id = self.search(cr, uid, []) + if picking_id: + self.action_cancel(cr, uid, picking_id, context=None) +- + Then I Cancel the production order and related stock moves. +- + !workflow {model: mrp.production, action: button_cancel, ref: mrp_production_mo2} \ No newline at end of file From f840413c844621f8f7e4f0f917543fffe695ab15 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 20 Sep 2011 14:01:26 +0530 Subject: [PATCH 13/36] [IMP]:change quantity for product in mrp bzr revid: ksa@tinyerp.com-20110920083126-4w3ad8izopmh4xd4 --- addons/mrp/test/mrp_production_order.yml | 14 +++++++++++++- addons/mrp_repair/test/test_mrp_repair.yml | 11 +++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/addons/mrp/test/mrp_production_order.yml b/addons/mrp/test/mrp_production_order.yml index 386f0673ab0..f829b1c4aae 100644 --- a/addons/mrp/test/mrp_production_order.yml +++ b/addons/mrp/test/mrp_production_order.yml @@ -142,4 +142,16 @@ - Then I Cancel the production order and related stock moves. - - !workflow {model: mrp.production, action: button_cancel, ref: mrp_production_mo2} \ No newline at end of file + !workflow {model: mrp.production, action: button_cancel, ref: mrp_production_mo2} +- + I am set the product quantity. +- + !record {model: change.production.qty, id: mrp_production_qty}: + product_qty: 5.0 +- + Changes the Quantity of Product. +- + !python {model: change.production.qty}: | + context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_qty")], "tz": False, "active_id":ref('mrp_production_qty')} + self.default_get(cr, uid, ["product_qty"], context) + self.change_prod_qty(cr, uid, [ref("mrp_production_qty")], context=context) diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index 655a93f1708..c2f993a311d 100644 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -241,10 +241,9 @@ - !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma2} - - Cancel Repair order using wizard. + Cancel Repair order using wizard. - - !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) \ No newline at end of file + !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) \ No newline at end of file From acfa31ee7e9fb097f1fbbb9607e941914f5d8ea6 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 20 Sep 2011 14:04:40 +0530 Subject: [PATCH 14/36] [REM]: unuse code in mrp operation bzr revid: ksa@tinyerp.com-20110920083440-sg4tfc3293130l0k --- .../test/mrp_operation_test.yml | 86 ------------------- 1 file changed, 86 deletions(-) diff --git a/addons/mrp_operations/test/mrp_operation_test.yml b/addons/mrp_operations/test/mrp_operation_test.yml index 593c00acedd..23e17b65c34 100644 --- a/addons/mrp_operations/test/mrp_operation_test.yml +++ b/addons/mrp_operations/test/mrp_operation_test.yml @@ -14,19 +14,6 @@ product_qty: 5.0 product_uom: product.product_uom_unit product_uos_qty: 5.0 -- - I create a production order. -- - !record {model: mrp.production, id: mrp_production_mo2}: - company_id: base.main_company - date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - location_dest_id: stock.stock_location_stock - location_src_id: stock.stock_location_stock - name: MO/012345678 - product_id: product.product_product_pc1 - product_qty: 5.0 - product_uom: product.product_uom_unit - product_uos_qty: 5.0 - I am computing the data. - @@ -35,22 +22,10 @@ False, "search_default_current": 1, "active_model": "ir.ui.menu", "active_ids": [ref("mrp.menu_mrp_production_action")], "active_id": ref("mrp.menu_mrp_production_action"), }) -- - I am computing the data. -- - !python {model: mrp.production}: | - self.action_compute(cr, uid, [ref("mrp_production_mo2")], {"lang": "en_US", "tz": - False, "search_default_current": 1, "active_model": "ir.ui.menu", "active_ids": - [ref("mrp.menu_mrp_production_action")], "active_id": ref("mrp.menu_mrp_production_action"), - }) - Now I confirm my production order. - !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo1} -- - Now I confirm my production order. -- - !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo2} - I check that there is one Work order generated related to my production order. - @@ -84,64 +59,3 @@ Then I cancel The Manufacturing order. - !workflow {model: mrp.production, action: button_cancel, ref: mrp_production_mo1} -- - I check that there is one Work order generated related to my production order. -- - !python {model: mrp.production.workcenter.line}: | - from tools.translate import _ - order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo2')),('state','=','draft')]) - assert order_id, _('No Work order!') -- - The scheduler runs. -- - !function {model: procurement.order, name: run_scheduler}: - - model: procurement.order - search: "[('state','=','confirmed')]" -- - I check that my production order and its related work order is in done state. -- - !python {model: mrp.production.workcenter.line}: | - from tools.translate import _ - prod_obj = self.pool.get('mrp.production') - prod_order_ids = prod_obj.search(cr, uid, [('origin','like','%MO/0123456')]) - assert prod_order_ids, _('Workorder not found') - workorder_id = self.search(cr, uid, [('production_id','=', prod_order_ids[0])]) - workorder_bro = self.browse(cr, uid, workorder_id[0]) - assert workorder_bro.state == 'done', _('Work order is not done! It is %s') % workorder_bro.state -- - Now I check my original production order is now ready. -- - !python {model: mrp.production}: | - from tools.translate import _ - import netsvc - wf_service = netsvc.LocalService("workflow") - prod_ids = self.search(cr, uid, [('id','=',ref('mrp_production_mo2')),('state','=','ready')]) - order_data = self.browse(cr, uid, prod_ids[0]) - if order_data: - wf_service.trg_validate(uid, 'mrp.production', order_data.id, 'button_produce', cr) - else: - assert prod_ids, _('Production order is not ready!') -- - I check that both internal pickings are done. -- - !python {model: stock.picking}: | - from tools.translate import _ - pick_ids = self.search(cr, uid, [('state','=','done'),('type','=','internal')]) - assert pick_ids, _('Internal pickings are not done!') -- - Now I start my first production order. -- - !workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0} -- - I check that the related work order is in progress state. -- - !python {model: mrp.production.workcenter.line}: | - from tools.translate import _ - import netsvc - wf_service = netsvc.LocalService("workflow") - order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo2')),('state','=','startworking')]) - order_data = self.browse(cr, uid, order_id[0]) - if order_data: - wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order_data.id, 'button_pause', cr) - else: - assert order_id, _('Work order not started yet!') From 994ff69f6f05fded01caa4fc40fe541dccb91786 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 20 Sep 2011 14:08:01 +0530 Subject: [PATCH 15/36] [IMP]: remove unuse code and improvement in mrp bzr revid: ksa@tinyerp.com-20110920083801-g3rtip63b6sy58ft --- addons/mrp/test/mrp_production_order.yml | 57 ++++++------------------ 1 file changed, 13 insertions(+), 44 deletions(-) diff --git a/addons/mrp/test/mrp_production_order.yml b/addons/mrp/test/mrp_production_order.yml index f829b1c4aae..a20d1c7f71e 100644 --- a/addons/mrp/test/mrp_production_order.yml +++ b/addons/mrp/test/mrp_production_order.yml @@ -56,6 +56,19 @@ from tools.translate import _ order_ids = self.search(cr, uid, [('state','=','ready')]) assert order_ids, _('No manufacturing order in Ready state!') +- + In order to cancel the MO, I first cancel its picking. +- + !python {model: stock.picking}: | + mrp_obj = self.pool.get('mrp.production') + mo = mrp_obj.browse(cr, uid, ref("mrp_production_mo1")) + picking_id = self.search(cr, uid, []) + if picking_id: + self.action_cancel(cr, uid, picking_id, context=None) +- + Then I Cancel the production order and related stock moves. +- + !workflow {model: mrp.production, action: button_cancel, ref: mrp_production_mo1} - I start producing that product first. So I marked it as started. - @@ -99,50 +112,6 @@ prod_obj = self.pool.get('mrp.production') prod_ids = prod_obj.search(cr, uid, [('product_id.default_code','=','PC1')]) self.do_produce(cr, uid, [ref('mrp_product_produce1')], context={'active_ids': prod_ids}) -- - I am creating one manufacturing order. -- - !record {model: mrp.production, id: mrp_production_mo2}: - company_id: base.main_company - date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - location_dest_id: stock.stock_location_stock - location_src_id: stock.stock_location_stock - product_id: product.product_product_pc1 - product_qty: 5.0 - product_uom: product.product_uom_unit - product_uos_qty: 0.0 -- - I compute the data. -- - !python {model: mrp.production}: | - self.action_compute(cr, uid, [ref("mrp_production_mo2")], {"lang": "en_US", "tz": - False, "search_default_current": 1, "active_model": "ir.ui.menu", "active_ids": - [ref("mrp.menu_mrp_production_action")], "active_id": ref("mrp.menu_mrp_production_action"), - }) -- - I confirm the order. -- - !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo2} -- - I am checking Internal picking. -- - !python {model: stock.picking}: | - from tools.translate import _ - pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal')]) - assert pick_ids, _('No Internal Pickings!') -- - In order to cancel the MO, I first cancel its picking. -- - !python {model: stock.picking}: | - mrp_obj = self.pool.get('mrp.production') - mo = mrp_obj.browse(cr, uid, ref("mrp_production_mo2")) - picking_id = self.search(cr, uid, []) - if picking_id: - self.action_cancel(cr, uid, picking_id, context=None) -- - Then I Cancel the production order and related stock moves. -- - !workflow {model: mrp.production, action: button_cancel, ref: mrp_production_mo2} - I am set the product quantity. - From ac12fc31c33eb8e60a187d913f448795137d4b43 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 20 Sep 2011 18:46:06 +0530 Subject: [PATCH 16/36] [IMP]:manage prices with tax included use compute_all instead of compute in mrp repair bzr revid: ksa@tinyerp.com-20110920131606-qohi5za7yjetfhp3 --- addons/mrp_repair/mrp_repair.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 6ea2a7d01c8..1735d5a567a 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -68,12 +68,14 @@ class mrp_repair(osv.osv): val = 0.0 cur = repair.pricelist_id.currency_id for line in repair.operations: + #manage prices with tax included use compute_all instead of compute + tax_calculate = tax_obj.compute_all(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id) if line.to_invoice: - for c in tax_obj.compute(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id): + for c in tax_calculate['taxes']: val += c['amount'] for line in repair.fees_lines: if line.to_invoice: - for c in tax_obj.compute(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id): + for c in tax_calculate['taxes']: val += c['amount'] res[repair.id] = cur_obj.round(cr, uid, cur, val) return res From 0a54692edd91a250715a386fccffc23673ad8cbd Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 21 Sep 2011 16:24:56 +0530 Subject: [PATCH 17/36] [IMP]: in mrp search proper picking id and in operation improve message and search picking id bzr revid: ksa@tinyerp.com-20110921105456-lbuag1hiqv4wej4m --- addons/mrp/test/mrp_production_order.yml | 24 ++++++++++--------- .../test/mrp_operation_test.yml | 24 ++++++------------- addons/mrp_operations/test/mrp_operations.yml | 24 ++++--------------- 3 files changed, 25 insertions(+), 47 deletions(-) diff --git a/addons/mrp/test/mrp_production_order.yml b/addons/mrp/test/mrp_production_order.yml index a20d1c7f71e..bf9ae66d042 100644 --- a/addons/mrp/test/mrp_production_order.yml +++ b/addons/mrp/test/mrp_production_order.yml @@ -11,6 +11,7 @@ location_dest_id: stock.stock_location_stock location_src_id: stock.stock_location_stock product_id: product.product_product_pc1 + name: MO/0123 product_qty: 5.0 product_uom: product.product_uom_unit product_uos_qty: 0.0 @@ -62,7 +63,7 @@ !python {model: stock.picking}: | mrp_obj = self.pool.get('mrp.production') mo = mrp_obj.browse(cr, uid, ref("mrp_production_mo1")) - picking_id = self.search(cr, uid, []) + picking_id = self.search(cr, uid, [('origin','like','%MO/0123')]) if picking_id: self.action_cancel(cr, uid, picking_id, context=None) - @@ -105,18 +106,10 @@ product_qty: 5.00 mode: 'consume_produce' - - Finally my production order is done. -- - !python {model: mrp.product.produce}: | - from tools.translate import _ - prod_obj = self.pool.get('mrp.production') - prod_ids = prod_obj.search(cr, uid, [('product_id.default_code','=','PC1')]) - self.do_produce(cr, uid, [ref('mrp_product_produce1')], context={'active_ids': prod_ids}) -- - I am set the product quantity. + I create record for producing products with quantity 8.00 - !record {model: change.production.qty, id: mrp_production_qty}: - product_qty: 5.0 + product_qty: 8.0 - Changes the Quantity of Product. - @@ -124,3 +117,12 @@ context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_qty")], "tz": False, "active_id":ref('mrp_production_qty')} self.default_get(cr, uid, ["product_qty"], context) self.change_prod_qty(cr, uid, [ref("mrp_production_qty")], context=context) +- + Finally my production order is done. +- + !python {model: mrp.product.produce}: | + from tools.translate import _ + prod_obj = self.pool.get('mrp.production') + prod_ids = prod_obj.search(cr, uid, [('product_id.default_code','=','PC1')]) + self.do_produce(cr, uid, [ref('mrp_product_produce1')], context={'active_ids': prod_ids}) + diff --git a/addons/mrp_operations/test/mrp_operation_test.yml b/addons/mrp_operations/test/mrp_operation_test.yml index 23e17b65c34..18d0f004bd4 100644 --- a/addons/mrp_operations/test/mrp_operation_test.yml +++ b/addons/mrp_operations/test/mrp_operation_test.yml @@ -1,7 +1,5 @@ - - In order to test mrp_operations module in OpenERP I will put a Production order - and check its effects on Work orders. -- + In order to test mrp_operations module in OpenERP, I create a production order. - !record {model: mrp.production, id: mrp_production_mo1}: @@ -15,24 +13,16 @@ product_uom: product.product_uom_unit product_uos_qty: 5.0 - - I am computing the data. -- - !python {model: mrp.production}: | - self.action_compute(cr, uid, [ref("mrp_production_mo1")], {"lang": "en_US", "tz": - False, "search_default_current": 1, "active_model": "ir.ui.menu", "active_ids": - [ref("mrp.menu_mrp_production_action")], "active_id": ref("mrp.menu_mrp_production_action"), - }) -- - Now I confirm my production order. + Now I confirm the production order. - !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo1} - - I check that there is one Work order generated related to my production order. + I check that there is one Work order generated related to the production order. - !python {model: mrp.production.workcenter.line}: | from tools.translate import _ order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo1')),('state','=','draft')]) - assert order_id, _('No Work order!') + assert order_id, _('No Work order define for this production order!') - The scheduler runs. - @@ -44,10 +34,10 @@ - !python {model: stock.picking}: | from tools.translate import _ - pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal')]) + pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal'),('origin','like','%MO/01234567')]) assert pick_ids, _('No Internal Pickings!') - - In order to cancel the MO, I first cancel its picking + In order to cancel the MO, first cancel its picking - !python {model: stock.picking}: | mrp_obj = self.pool.get('mrp.production') @@ -56,6 +46,6 @@ if picking_id: self.action_cancel(cr, uid, picking_id, context=None) - - Then I cancel The Manufacturing order. + Then cancel The Manufacturing order. - !workflow {model: mrp.production, action: button_cancel, ref: mrp_production_mo1} diff --git a/addons/mrp_operations/test/mrp_operations.yml b/addons/mrp_operations/test/mrp_operations.yml index 43a27d48994..ce6aac5cdbf 100644 --- a/addons/mrp_operations/test/mrp_operations.yml +++ b/addons/mrp_operations/test/mrp_operations.yml @@ -33,7 +33,7 @@ !python {model: mrp.production.workcenter.line}: | from tools.translate import _ order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','draft')]) - assert order_id, _('No Work order!') + assert order_id, _('No Work order define for this production order!') - The scheduler runs. - @@ -62,7 +62,7 @@ prod_obj = self.pool.get('mrp.production') prod_order_ids = prod_obj.search(cr, uid, [('state','=','ready'),('origin','like','%MO/0123456')]) workorder_id = self.search(cr, uid, [('production_id','=', prod_order_ids[0]),('state','=','draft')]) - assert workorder_id, _('No Work order!') + assert workorder_id, _('No Work order define for this production order!') - I start the second production order of the CPU_GEN product. - @@ -103,14 +103,8 @@ - !python {model: mrp.production}: | from tools.translate import _ - import netsvc - wf_service = netsvc.LocalService("workflow") prod_ids = self.search(cr, uid, [('id','=',ref('mrp_production_mo0')),('state','=','ready')]) - order_data = self.browse(cr, uid, prod_ids[0]) - if order_data: - wf_service.trg_validate(uid, 'mrp.production', order_data.id, 'button_produce', cr) - else: - assert prod_ids, _('Production order is not ready!') + assert prod_ids, _('Production order is not ready!') - I check that both internal pickings are done. - @@ -127,14 +121,8 @@ - !python {model: mrp.production.workcenter.line}: | from tools.translate import _ - import netsvc - wf_service = netsvc.LocalService("workflow") order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','startworking')]) - order_data = self.browse(cr, uid, order_id[0]) - if order_data: - wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order_data.id, 'button_start_working', cr) - else: - assert order_id, _('Work order not started yet!') + assert order_id, _('Work order not started yet!') - I am creating a mrp.product.produce record. - @@ -167,6 +155,4 @@ - !python {model: mrp.production}: | mo = self.browse(cr, uid, ref("mrp_production_mo0")) - prop=mo.date_planned - unknow_none=False - self._production_date_end(cr, uid, [ref("mrp_production_mo0")], prop, unknow_none, context=None) + self._production_date_end(cr, uid, [ref("mrp_production_mo0")], mo.date_planned, False, context=None) From 5829a12411a21d678ebefaad7683890ff3eec322 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 21 Sep 2011 16:40:33 +0530 Subject: [PATCH 18/36] [ADD]: cancel repair order and check for Invoice Type b4repair bzr revid: ksa@tinyerp.com-20110921111033-6p8ztmpqtqzh2y49 --- addons/mrp_repair/__openerp__.py | 2 +- addons/mrp_repair/test/mrp_repair_cancel.yml | 85 +++++++++++++++++++ addons/mrp_repair/test/test_mrp_repair.yml | 88 +------------------- 3 files changed, 87 insertions(+), 88 deletions(-) create mode 100644 addons/mrp_repair/test/mrp_repair_cancel.yml diff --git a/addons/mrp_repair/__openerp__.py b/addons/mrp_repair/__openerp__.py index 134b16542a5..5d86291bd88 100644 --- a/addons/mrp_repair/__openerp__.py +++ b/addons/mrp_repair/__openerp__.py @@ -48,7 +48,7 @@ The aim is to have a complete module to manage all products repairs. The followi 'mrp_repair_report.xml', ], 'demo_xml': [], - 'test': ['test/test_mrp_repair.yml', 'test/mrp_repair_report.yml'], + '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/test/mrp_repair_cancel.yml b/addons/mrp_repair/test/mrp_repair_cancel.yml new file mode 100644 index 00000000000..dfc0eac27ba --- /dev/null +++ b/addons/mrp_repair/test/mrp_repair_cancel.yml @@ -0,0 +1,85 @@ +- + I start by creating new Repair order for "Basic Pc" product and Invoice Type None. +- + !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} +- + Cancel 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 start by creating new Repair order for "Basic Pc" product and Invoice Type b4repair. +- + !record {model: mrp.repair, id: mrp_repair_rma1}: + 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_move_pcbasicpc0' + name: RMA00005 + 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 For Invoice Type b4repair. +- + !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma1} +- + I start the repairing process by click on "Start Repair" Button For Invoice Type b4repair. +- + !workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rma1} +- + 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_rma1} \ No newline at end of file diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index c2f993a311d..b07e1944812 100644 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -48,39 +48,6 @@ partner_id: base.res_partner_9 product_id: product.product_product_pc1 -- | - I start by creating new Repair order for "Basic Pc" product and Invoice Type b4repair. - -- - !record {model: mrp.repair, id: mrp_repair_rma1}: - 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_move_pcbasicpc0' - name: RMA00005 - 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 check that Repair order is in "Draft" state. - @@ -92,18 +59,10 @@ - !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma0} -- | - I confirm This Repair order For Invoice Type b4repair. -- - !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma1} - | I start the repairing process by click on "Start Repair" Button For Invoice Type b4repair. - !workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rma0} -- | - I start the repairing process by click on "Start Repair" Button For Invoice Type b4repair. -- - !workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rma1} - | I check that state is "Under Repair". @@ -114,10 +73,7 @@ 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} -- | - 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_rma1} + - | I select invoiced after repair option in this "RMA00004" Repair order. so I create Invoice by click on "Make Invoice" wizard. @@ -205,45 +161,3 @@ lot=False product_id=repair_id.product_id self.onchange_lot_id(cr, uid, [ref('mrp_repair_rma0')], lot, product_id) -- - I start by creating new Repair order for "Basic Pc" product and Invoice Type None. -- - !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} -- - Cancel Repair order using wizard. -- - !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) \ No newline at end of file From c6cb0c8785457ed766c26db406e9f323a28c8558 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 21 Sep 2011 17:06:31 +0530 Subject: [PATCH 19/36] [REM]: unuse variable name and method bzr revid: ksa@tinyerp.com-20110921113631-nmkkhood1ozkq46b --- addons/mrp_repair/mrp_repair.py | 35 ++++++++++++---------- addons/mrp_repair/test/test_mrp_repair.yml | 20 +++---------- 2 files changed, 23 insertions(+), 32 deletions(-) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 1735d5a567a..aff6a30ffc2 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -69,12 +69,13 @@ class mrp_repair(osv.osv): cur = repair.pricelist_id.currency_id for line in repair.operations: #manage prices with tax included use compute_all instead of compute - tax_calculate = tax_obj.compute_all(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id) if line.to_invoice: + tax_calculate = tax_obj.compute_all(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id) for c in tax_calculate['taxes']: val += c['amount'] for line in repair.fees_lines: if line.to_invoice: + tax_calculate = tax_obj.compute_all(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id) for c in tax_calculate['taxes']: val += c['amount'] res[repair.id] = cur_obj.round(cr, uid, cur, val) @@ -480,21 +481,23 @@ class mrp_repair(osv.osv): repair.write({'state': 'under_repair'}) return True - def action_invoice_end(self, cr, uid, ids, context=None): - """ Writes repair order state to 'Ready' if invoice method is Before repair. - @return: True - """ - repair_line = self.pool.get('mrp.repair.line') - for order in self.browse(cr, uid, ids, context=context): - val = {} - if (order.invoice_method == 'b4repair'): - val['state'] = 'ready' - repair_line.write(cr, uid, [l.id for - l in order.operations], {'state': 'confirmed'}, context=context) - else: - pass - self.write(cr, uid, [order.id], val, context=context) - return True +# Remove this method because not use any where + +# def action_invoice_end(self, cr, uid, ids, context=None): +# """ Writes repair order state to 'Ready' if invoice method is Before repair. +# @return: True +# """ +# repair_line = self.pool.get('mrp.repair.line') +# for order in self.browse(cr, uid, ids, context=context): +# val = {} +# if (order.invoice_method == 'b4repair'): +# val['state'] = 'ready' +# repair_line.write(cr, uid, [l.id for +# l in order.operations], {'state': 'confirmed'}, context=context) +# else: +# pass +# self.write(cr, uid, [order.id], val, context=context) +# return True def action_repair_end(self, cr, uid, ids, context=None): """ Writes repair order state to 'To be invoiced' if invoice method is diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index b07e1944812..26465c23baf 100644 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -121,11 +121,6 @@ - !python {model: mrp.repair}: | self.action_invoice_cancel(cr, uid, [ref('mrp_repair_rma0')], context=None) -- | - Writes repair order state to 'Ready' if invoice method is Before repair. -- - !python {model: mrp.repair}: | - self.action_invoice_end(cr, uid, [ref('mrp_repair_rma0')], context=None) - | Creates stock move and picking for repair order - @@ -136,28 +131,21 @@ - !python {model: mrp.repair}: | repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0] - prod_id=False - move_id=repair_id.move_id - self.onchange_move_id(cr, uid, [ref('mrp_repair_rma0')], prod_id, move_id) + 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}: | - guarantee_limit=False - self.onchange_operation_type(cr, uid, [ref('mrp_repair_rma0')], type, guarantee_limit) + self.onchange_operation_type(cr, uid, [ref('mrp_repair_rma0')], type, False) - | 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] - part=False - address_id=False - self.onchange_partner_id(cr, uid, [ref('mrp_repair_rma0')], part, address_id) + 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] - lot=False - product_id=repair_id.product_id - self.onchange_lot_id(cr, uid, [ref('mrp_repair_rma0')], lot, product_id) + self.onchange_lot_id(cr, uid, [ref('mrp_repair_rma0')], False, repair_id.product_id) From 53b4c561beed2a2943f8f2ff4b61658c4d0f3f1f Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 21 Sep 2011 17:09:12 +0530 Subject: [PATCH 20/36] [REM]: unuse variable name and method bzr revid: ksa@tinyerp.com-20110921113912-ytotb6rh424xemnj --- addons/mrp_repair/mrp_repair.py | 14 ++++++++------ addons/mrp_repair/test/test_mrp_repair.yml | 5 ----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index aff6a30ffc2..4cd47f14ea2 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -463,12 +463,14 @@ class mrp_repair(osv.osv): self.write(cr, uid, [repair.id], {'state': 'ready'}) return True - def action_invoice_cancel(self, cr, uid, ids, context=None): - """ Writes repair order state to 'Exception in invoice' - @return: True - """ - self.write(cr, uid, ids, {'state': 'invoice_except'}) - return True +#Remove this method because not use any where + +# def action_invoice_cancel(self, cr, uid, ids, context=None): +# """ Writes repair order state to 'Exception in invoice' +# @return: True +# """ +# self.write(cr, uid, ids, {'state': 'invoice_except'}) +# return True def action_repair_start(self, cr, uid, ids, context=None): """ Writes repair order state to 'Under Repair' diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index 26465c23baf..aa43ea67844 100644 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -116,11 +116,6 @@ - !python {model: mrp.repair}: | self.action_repair_ready(cr, uid, [ref('mrp_repair_rma0')], context=None) -- | - Writes repair order state to 'Exception in invoice' -- - !python {model: mrp.repair}: | - self.action_invoice_cancel(cr, uid, [ref('mrp_repair_rma0')], context=None) - | Creates stock move and picking for repair order - From 23ac71a177e646f41b88256f6809717e7c1c3970 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 21 Sep 2011 17:25:36 +0530 Subject: [PATCH 21/36] [IMP]: for mrp repair bzr revid: ksa@tinyerp.com-20110921115536-lh9dh6fzomqh046b --- addons/mrp_repair/test/test_mrp_repair.yml | 77 ++++++++-------------- 1 file changed, 28 insertions(+), 49 deletions(-) diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index aa43ea67844..52dc56ccbd8 100644 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -47,7 +47,34 @@ 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) +- | + 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. - @@ -96,51 +123,3 @@ invoice_id = inv_obj.browse(cr, uid, invoice_ids)[0] assert repair_id.partner_id.id == invoice_id.partner_id.id, "No invoice existing for the same partner" -- | - On change of product sets some values -- - !python {model: mrp.repair}: | - self.onchange_product_id(cr, uid, [ref('mrp_repair_rma0')], product_id=False) -- | - Cancels repair order. -- - !python {model: mrp.repair}: | - self.action_cancel(cr, uid, [ref('mrp_repair_rma0')], context=None) -- | - Cancels repair order when it is in 'Draft' state -- - !python {model: mrp.repair}: | - self.action_cancel_draft(cr, uid, [ref('mrp_repair_rma0')]) -- | - Writes repair order state to 'Ready'. -- - !python {model: mrp.repair}: | - self.action_repair_ready(cr, uid, [ref('mrp_repair_rma0')], context=None) -- | - Creates stock move and picking for repair order -- - !python {model: mrp.repair}: | - self.wkf_repair_done(cr, uid, [ref('mrp_repair_rma0')]) -- | - 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) -- | - 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) From 61a506a07b9cae93cb377d5cdd09952e212ced53 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 21 Sep 2011 18:08:44 +0530 Subject: [PATCH 22/36] [IMP]: for mrp repair bzr revid: ksa@tinyerp.com-20110921123844-jyu32u7qept27cn7 --- addons/mrp_repair/test/mrp_repair_cancel.yml | 12 +++++++++++- addons/mrp_repair/test/test_mrp_repair.yml | 7 +++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/addons/mrp_repair/test/mrp_repair_cancel.yml b/addons/mrp_repair/test/mrp_repair_cancel.yml index dfc0eac27ba..fa9b02018b6 100644 --- a/addons/mrp_repair/test/mrp_repair_cancel.yml +++ b/addons/mrp_repair/test/mrp_repair_cancel.yml @@ -40,6 +40,16 @@ 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) +- + Reopen the repair order in draft state. +- + !python {model: mrp.repair}: | + self.action_cancel_draft(cr, uid, [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 start by creating new Repair order for "Basic Pc" product and Invoice Type b4repair. - @@ -82,4 +92,4 @@ - 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_rma1} \ No newline at end of file + !workflow {model: mrp.repair, action: action_repair_end, ref: mrp_repair_rma1} diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index 52dc56ccbd8..a35ef966ce9 100644 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -80,7 +80,6 @@ - !assert {model: mrp.repair, id: mrp_repair_rma0}: - state == 'draft' - - | I confirm This Repair order. - @@ -121,5 +120,9 @@ repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0] invoice_ids = inv_obj.search(cr, uid, [('partner_id', '=', repair_id.partner_id.id)]) invoice_id = inv_obj.browse(cr, uid, invoice_ids)[0] - assert repair_id.partner_id.id == invoice_id.partner_id.id, "No invoice existing for the same partner" +- | + Cancel repair order. +- + !python {model: mrp.repair}: | + self.action_cancel(cr, uid, [ref('mrp_repair_rma0')], context=None) \ No newline at end of file From 442c2db1b8e5d89b3cc9f6e615d66253f9fa8dbe Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Fri, 23 Sep 2011 12:38:48 +0530 Subject: [PATCH 23/36] [REM]:cancel for MO related code bzr revid: ksa@tinyerp.com-20110923070848-ttna13tiagxkxj4i --- addons/mrp/test/mrp_production_order.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/addons/mrp/test/mrp_production_order.yml b/addons/mrp/test/mrp_production_order.yml index bf9ae66d042..f87a1badc74 100644 --- a/addons/mrp/test/mrp_production_order.yml +++ b/addons/mrp/test/mrp_production_order.yml @@ -57,19 +57,6 @@ from tools.translate import _ order_ids = self.search(cr, uid, [('state','=','ready')]) assert order_ids, _('No manufacturing order in Ready state!') -- - In order to cancel the MO, I first cancel its picking. -- - !python {model: stock.picking}: | - mrp_obj = self.pool.get('mrp.production') - mo = mrp_obj.browse(cr, uid, ref("mrp_production_mo1")) - picking_id = self.search(cr, uid, [('origin','like','%MO/0123')]) - if picking_id: - self.action_cancel(cr, uid, picking_id, context=None) -- - Then I Cancel the production order and related stock moves. -- - !workflow {model: mrp.production, action: button_cancel, ref: mrp_production_mo1} - I start producing that product first. So I marked it as started. - @@ -125,4 +112,3 @@ prod_obj = self.pool.get('mrp.production') prod_ids = prod_obj.search(cr, uid, [('product_id.default_code','=','PC1')]) self.do_produce(cr, uid, [ref('mrp_product_produce1')], context={'active_ids': prod_ids}) - From 6e4b50de3ec1544f573864386ed12118a1da7f98 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Fri, 23 Sep 2011 12:40:19 +0530 Subject: [PATCH 24/36] [ADD]:check cancel for MO bzr revid: ksa@tinyerp.com-20110923071019-xnh15t2tl6dtmfe8 --- addons/mrp/__openerp__.py | 1 + addons/mrp/test/mrp_production_cancel.yml | 31 +++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 addons/mrp/test/mrp_production_cancel.yml diff --git a/addons/mrp/__openerp__.py b/addons/mrp/__openerp__.py index 0eb8c89c6c0..b7b97aef158 100644 --- a/addons/mrp/__openerp__.py +++ b/addons/mrp/__openerp__.py @@ -97,6 +97,7 @@ Dashboard provided by this module: 'test/mrp_packs.yml', 'test/mrp_phantom_bom.yml', 'test/mrp_production_order.yml', + 'test/mrp_production_cancel.yml', 'test/mrp_report.yml', ], diff --git a/addons/mrp/test/mrp_production_cancel.yml b/addons/mrp/test/mrp_production_cancel.yml new file mode 100644 index 00000000000..747155e356c --- /dev/null +++ b/addons/mrp/test/mrp_production_cancel.yml @@ -0,0 +1,31 @@ +- + In order to test the manufacturing order in Openerp, + I am creating one manufacturing order +- + !record {model: mrp.production, id: mrp_production_mo1}: + company_id: base.main_company + date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") + location_dest_id: stock.stock_location_stock + location_src_id: stock.stock_location_stock + product_id: product.product_product_pc1 + name: MO/01234 + product_qty: 5.0 + product_uom: product.product_uom_unit + product_uos_qty: 0.0 +- + I confirm the order. +- + !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo1} +- + In order to cancel the MO, I first cancel its picking. +- + !python {model: stock.picking}: | + mrp_obj = self.pool.get('mrp.production') + mo = mrp_obj.browse(cr, uid, ref("mrp_production_mo1")) + picking_id = self.search(cr, uid, [('id','=',mo.picking_id.id)]) + if picking_id: + self.action_cancel(cr, uid, picking_id, context=None) +- + Then I Cancel the production order and related stock moves. +- + !workflow {model: mrp.production, action: button_cancel, ref: mrp_production_mo1} \ No newline at end of file From 3a2a72fca9b90ad40fa339e73a71b4ca0817cd60 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Fri, 23 Sep 2011 12:55:42 +0530 Subject: [PATCH 25/36] [IMP]:create make invoice for b4repair bzr revid: ksa@tinyerp.com-20110923072542-z4greir3flwu0lvw --- addons/mrp_repair/test/mrp_repair_cancel.yml | 22 ++++++++++++++++++++ addons/mrp_repair/test/test_mrp_repair.yml | 7 +------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/addons/mrp_repair/test/mrp_repair_cancel.yml b/addons/mrp_repair/test/mrp_repair_cancel.yml index fa9b02018b6..f4a2891654d 100644 --- a/addons/mrp_repair/test/mrp_repair_cancel.yml +++ b/addons/mrp_repair/test/mrp_repair_cancel.yml @@ -93,3 +93,25 @@ 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_rma1} + +- | + I select invoiced before repair option in this "RMA00005" 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_rma1")]}) +- | + I check that Invoice is created for this repair order. +- + !python {model: mrp.repair}: | + obj_lines = self.pool.get('account.invoice.line') + inv_obj = self.pool.get('account.invoice') + repair_id = self.browse(cr, uid, [ref('mrp_repair_rma1')], context=context)[0] + invoice_ids = inv_obj.search(cr, uid, [('partner_id', '=', repair_id.partner_id.id)]) + invoice_id = inv_obj.browse(cr, uid, invoice_ids)[0] + assert repair_id.partner_id.id == invoice_id.partner_id.id, "No invoice existing for the same partner" diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index a35ef966ce9..b51b66a48e8 100644 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -86,7 +86,7 @@ !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma0} - | - I start the repairing process by click on "Start Repair" Button For Invoice Type b4repair. + 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} @@ -121,8 +121,3 @@ invoice_ids = inv_obj.search(cr, uid, [('partner_id', '=', repair_id.partner_id.id)]) invoice_id = inv_obj.browse(cr, uid, invoice_ids)[0] assert repair_id.partner_id.id == invoice_id.partner_id.id, "No invoice existing for the same partner" -- | - Cancel repair order. -- - !python {model: mrp.repair}: | - self.action_cancel(cr, uid, [ref('mrp_repair_rma0')], context=None) \ No newline at end of file From 8d814c0a73757bd996d6666931206c17c09e7d9b Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Fri, 23 Sep 2011 14:11:07 +0530 Subject: [PATCH 26/36] [IMP]:yml for mrp repair bzr revid: ksa@tinyerp.com-20110923084107-n7b9v32m8yav9enf --- addons/mrp_repair/test/mrp_repair_cancel.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/mrp_repair/test/mrp_repair_cancel.yml b/addons/mrp_repair/test/mrp_repair_cancel.yml index f4a2891654d..96f930192b1 100644 --- a/addons/mrp_repair/test/mrp_repair_cancel.yml +++ b/addons/mrp_repair/test/mrp_repair_cancel.yml @@ -50,6 +50,11 @@ - !python {model: mrp.repair}: | self.action_repair_ready(cr, uid, [ref('mrp_repair_rma2')], context=None) +- + Cancel repair order. +- + !python {model: mrp.repair}: | + self.action_cancel(cr, uid, [ref('mrp_repair_rma2')], context=None) - I start by creating new Repair order for "Basic Pc" product and Invoice Type b4repair. - From 4f0a3083b1be8d11223a2a304cab4bfa76440cff Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Mon, 26 Sep 2011 10:29:55 +0530 Subject: [PATCH 27/36] [IMP]:set in proper flow for mrp bzr revid: ksa@tinyerp.com-20110926045955-wrqewcb1047fi9lf --- addons/mrp/test/mrp_production_order.yml | 25 ++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/addons/mrp/test/mrp_production_order.yml b/addons/mrp/test/mrp_production_order.yml index f87a1badc74..fecb7e31f1e 100644 --- a/addons/mrp/test/mrp_production_order.yml +++ b/addons/mrp/test/mrp_production_order.yml @@ -27,6 +27,19 @@ I confirm the order. - !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo1} +- + I create record for producing products with quantity 8.00 +- + !record {model: change.production.qty, id: mrp_production_qty}: + product_qty: 8.0 +- + Changes the Quantity of Product. +- + !python {model: change.production.qty}: | + context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_qty")], "tz": False, "active_id":ref('mrp_production_qty')} + self.default_get(cr, uid, ["product_qty"], context) + self.change_prod_qty(cr, uid, [ref("mrp_production_qty")], context=context) +- - I am checking Procurement orders for components of PC1. - @@ -92,18 +105,6 @@ !record {model: mrp.product.produce, id: mrp_product_produce1}: product_qty: 5.00 mode: 'consume_produce' -- - I create record for producing products with quantity 8.00 -- - !record {model: change.production.qty, id: mrp_production_qty}: - product_qty: 8.0 -- - Changes the Quantity of Product. -- - !python {model: change.production.qty}: | - context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_qty")], "tz": False, "active_id":ref('mrp_production_qty')} - self.default_get(cr, uid, ["product_qty"], context) - self.change_prod_qty(cr, uid, [ref("mrp_production_qty")], context=context) - Finally my production order is done. - From 147b1a96d76f80cb6b0d7ad19bac1ebad7b98656 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Mon, 26 Sep 2011 10:31:50 +0530 Subject: [PATCH 28/36] [IMP]:set in proper flow for b4repair in mrp repair bzr revid: ksa@tinyerp.com-20110926050150-hrhe57kt8buuxuiu --- addons/mrp_repair/test/mrp_repair_cancel.yml | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/mrp_repair/test/mrp_repair_cancel.yml b/addons/mrp_repair/test/mrp_repair_cancel.yml index 96f930192b1..4e8d0167178 100644 --- a/addons/mrp_repair/test/mrp_repair_cancel.yml +++ b/addons/mrp_repair/test/mrp_repair_cancel.yml @@ -91,26 +91,17 @@ - !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma1} - - I start the repairing process by click on "Start Repair" Button For Invoice Type b4repair. -- - !workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rma1} -- - 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_rma1} - -- | I select invoiced before repair option in this "RMA00005" 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_rma1")]}) -- | +- I check that Invoice is created for this repair order. - !python {model: mrp.repair}: | @@ -120,3 +111,12 @@ invoice_ids = inv_obj.search(cr, uid, [('partner_id', '=', repair_id.partner_id.id)]) invoice_id = inv_obj.browse(cr, uid, invoice_ids)[0] assert repair_id.partner_id.id == invoice_id.partner_id.id, "No invoice existing for the same partner" +- + I start the repairing process by click on "Start Repair" Button For Invoice Type b4repair. +- + !workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rma1} +- + 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_rma1} + From aa487a5cbec4c8f7af041578ba1281b9d38f57b7 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Mon, 26 Sep 2011 14:33:02 +0530 Subject: [PATCH 29/36] [IMP]:yml for mrp repair bzr revid: ksa@tinyerp.com-20110926090302-x7tb3irvh7cfd9zh --- addons/mrp/test/mrp_production_cancel.yml | 4 +- addons/mrp_repair/test/mrp_repair_cancel.yml | 83 ++++++++------------ 2 files changed, 35 insertions(+), 52 deletions(-) diff --git a/addons/mrp/test/mrp_production_cancel.yml b/addons/mrp/test/mrp_production_cancel.yml index 747155e356c..e08917bc90c 100644 --- a/addons/mrp/test/mrp_production_cancel.yml +++ b/addons/mrp/test/mrp_production_cancel.yml @@ -22,9 +22,7 @@ !python {model: stock.picking}: | mrp_obj = self.pool.get('mrp.production') mo = mrp_obj.browse(cr, uid, ref("mrp_production_mo1")) - picking_id = self.search(cr, uid, [('id','=',mo.picking_id.id)]) - if picking_id: - self.action_cancel(cr, uid, picking_id, context=None) + self.action_cancel(cr, uid, mo.picking_id.id, context=None) - Then I Cancel the production order and related stock moves. - diff --git a/addons/mrp_repair/test/mrp_repair_cancel.yml b/addons/mrp_repair/test/mrp_repair_cancel.yml index 4e8d0167178..187858cf745 100644 --- a/addons/mrp_repair/test/mrp_repair_cancel.yml +++ b/addons/mrp_repair/test/mrp_repair_cancel.yml @@ -1,15 +1,33 @@ - - I start by creating new Repair order for "Basic Pc" product and Invoice Type None. + In order to test "mrp_repair" module. +- + I have create 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_stock + 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 Type b4repair. - !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' + 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_move_pcbasicpc0' name: RMA000055 + invoiced: 1 operations: - location_dest_id: stock.location_production location_id: stock.stock_location_stock @@ -56,67 +74,34 @@ !python {model: mrp.repair}: | self.action_cancel(cr, uid, [ref('mrp_repair_rma2')], context=None) - - I start by creating new Repair order for "Basic Pc" product and Invoice Type b4repair. + Reopen the repair order in draft state. - - !record {model: mrp.repair, id: mrp_repair_rma1}: - 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_move_pcbasicpc0' - name: RMA00005 - 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 + !python {model: mrp.repair}: | + self.action_cancel_draft(cr, uid, [ref('mrp_repair_rma2')]) - I confirm This Repair order For Invoice Type b4repair. - - !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma1} -- - I select invoiced before repair option in this "RMA00005" 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 + !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma2} - 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_rma1")]}) + !python {model: mrp.repair}: | + import netsvc + wf_service = netsvc.LocalService("workflow") + wf_service.trg_validate(uid, 'mrp.repair', ref("mrp_repair.mrp_repair_rma2"), 'action_invoice_create', cr) - I check that Invoice is created for this repair order. - - !python {model: mrp.repair}: | - obj_lines = self.pool.get('account.invoice.line') - inv_obj = self.pool.get('account.invoice') - repair_id = self.browse(cr, uid, [ref('mrp_repair_rma1')], context=context)[0] - invoice_ids = inv_obj.search(cr, uid, [('partner_id', '=', repair_id.partner_id.id)]) - invoice_id = inv_obj.browse(cr, uid, invoice_ids)[0] - assert repair_id.partner_id.id == invoice_id.partner_id.id, "No invoice existing for the same partner" + !python {model: account.invoice}: | + mrp_obj = self.pool.get('mrp.repair') + repair_id = mrp_obj.browse(cr, uid, [ref('mrp_repair_rma2')], context=context)[0] + assert repair_id.invoice_id.id, _("No invoice existing for this partner") - I start the repairing process by click on "Start Repair" Button For Invoice Type b4repair. - - !workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rma1} + !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_rma1} + !workflow {model: mrp.repair, action: action_repair_end, ref: mrp_repair_rma2} From 3a5cc6d1e018062880662bb6c1352ffa24ad631c Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Mon, 26 Sep 2011 14:40:42 +0530 Subject: [PATCH 30/36] [IMP]:yml for mrp operation bzr revid: ksa@tinyerp.com-20110926091042-s78kwk8f4yd4x40o --- addons/mrp_operations/test/mrp_operation_test.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/mrp_operations/test/mrp_operation_test.yml b/addons/mrp_operations/test/mrp_operation_test.yml index 18d0f004bd4..dfaa00f9594 100644 --- a/addons/mrp_operations/test/mrp_operation_test.yml +++ b/addons/mrp_operations/test/mrp_operation_test.yml @@ -34,7 +34,7 @@ - !python {model: stock.picking}: | from tools.translate import _ - pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal'),('origin','like','%MO/01234567')]) + pick_ids = self.search(cr, uid, [('type','=','internal')]) assert pick_ids, _('No Internal Pickings!') - In order to cancel the MO, first cancel its picking @@ -42,9 +42,7 @@ !python {model: stock.picking}: | mrp_obj = self.pool.get('mrp.production') mo = mrp_obj.browse(cr, uid, ref("mrp_production_mo1")) - picking_id = self.search(cr, uid, [('origin','like','%MO/01234567')]) - if picking_id: - self.action_cancel(cr, uid, picking_id, context=None) + self.action_cancel(cr, uid, [mo.picking_id.id], context=None) - Then cancel The Manufacturing order. - From ad4681729130f1476ffc8635b44fc57fb9cd443c Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Mon, 26 Sep 2011 15:26:33 +0530 Subject: [PATCH 31/36] [IMP]:yml for mrp operation bzr revid: ksa@tinyerp.com-20110926095633-k4xbr9yextxcf4i8 --- addons/mrp/test/mrp_production_cancel.yml | 2 +- addons/mrp_operations/test/mrp_operation_test.yml | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/addons/mrp/test/mrp_production_cancel.yml b/addons/mrp/test/mrp_production_cancel.yml index e08917bc90c..1dc20a215d1 100644 --- a/addons/mrp/test/mrp_production_cancel.yml +++ b/addons/mrp/test/mrp_production_cancel.yml @@ -22,7 +22,7 @@ !python {model: stock.picking}: | mrp_obj = self.pool.get('mrp.production') mo = mrp_obj.browse(cr, uid, ref("mrp_production_mo1")) - self.action_cancel(cr, uid, mo.picking_id.id, context=None) + self.action_cancel(cr, uid, [mo.picking_id.id], context=None) - Then I Cancel the production order and related stock moves. - diff --git a/addons/mrp_operations/test/mrp_operation_test.yml b/addons/mrp_operations/test/mrp_operation_test.yml index dfaa00f9594..590811119d2 100644 --- a/addons/mrp_operations/test/mrp_operation_test.yml +++ b/addons/mrp_operations/test/mrp_operation_test.yml @@ -32,10 +32,10 @@ - I am checking Internal picking. - - !python {model: stock.picking}: | + !python {model: mrp.production}: | from tools.translate import _ - pick_ids = self.search(cr, uid, [('type','=','internal')]) - assert pick_ids, _('No Internal Pickings!') + pick_ids = self.browse(cr, uid, ref("mrp_production_mo1")) + assert pick_ids.picking_id.id, _('No Internal Pickings!') - In order to cancel the MO, first cancel its picking - @@ -47,3 +47,10 @@ Then cancel The Manufacturing order. - !workflow {model: mrp.production, action: button_cancel, ref: mrp_production_mo1} +- + I check that there is one Work order generated related to the production order that is cancel or not. +- + !python {model: mrp.production.workcenter.line}: | + from tools.translate import _ + order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo1')),('state','=','cancel')]) + assert order_id, _('Work order is not cancel for this production order!') \ No newline at end of file From a8e8a033ffefab5ad3ac84c27603996a775cdbcb Mon Sep 17 00:00:00 2001 From: "Rucha (Open ERP)" Date: Mon, 26 Sep 2011 19:03:34 +0530 Subject: [PATCH 32/36] [IMP, FIX]: mrp_repair: taken proper destination location for yml demo * Fixed flow of repair cancel yml * Improvement in test statements bzr revid: rpa@tinyerp.com-20110926133334-la8tj3yqf98gd3jm --- addons/mrp_repair/test/mrp_repair_cancel.yml | 59 +++++++++----------- addons/mrp_repair/test/test_mrp_repair.yml | 10 +--- 2 files changed, 29 insertions(+), 40 deletions(-) diff --git a/addons/mrp_repair/test/mrp_repair_cancel.yml b/addons/mrp_repair/test/mrp_repair_cancel.yml index 187858cf745..9a13d3c5d8b 100644 --- a/addons/mrp_repair/test/mrp_repair_cancel.yml +++ b/addons/mrp_repair/test/mrp_repair_cancel.yml @@ -1,13 +1,11 @@ - - In order to test "mrp_repair" module. -- - I have create stock move line record. + 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_stock + location_dest_id: stock.stock_location_14 location_id: stock.stock_location_stock name: '[PC1] Basic PC' product_id: product.product_product_pc1 @@ -16,18 +14,17 @@ product_uos_qty: 1.0 - - I start by creating new Repair order for "Basic Pc" product and Invoice Type b4repair. + 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: 'b4repair' + 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 - invoiced: 1 operations: - location_dest_id: stock.location_production location_id: stock.stock_location_stock @@ -48,56 +45,52 @@ partner_id: base.res_partner_9 product_id: product.product_product_pc1 - - I confirm This Repair order. + I confirm this Repair order. - !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma2} - - Cancel Repair order. + 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. - - Reopen the repair order in draft 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) -- - Cancel repair order. -- - !python {model: mrp.repair}: | - self.action_cancel(cr, uid, [ref('mrp_repair_rma2')], context=None) -- - Reopen the repair order in draft state. -- - !python {model: mrp.repair}: | - self.action_cancel_draft(cr, uid, [ref('mrp_repair_rma2')]) -- - I confirm This Repair order For Invoice Type b4repair. -- - !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma2} - I click on "Create Invoice" button of this wizard to make invoice. - - !python {model: mrp.repair}: | - import netsvc - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'mrp.repair', ref("mrp_repair.mrp_repair_rma2"), 'action_invoice_create', cr) + !workflow {model: mrp.repair, action: action_invoice_create, ref: mrp_repair_rma2} - I check that Invoice is created for this repair order. - - !python {model: account.invoice}: | - mrp_obj = self.pool.get('mrp.repair') - repair_id = mrp_obj.browse(cr, uid, [ref('mrp_repair_rma2')], context=context)[0] - assert repair_id.invoice_id.id, _("No invoice existing for this partner") + !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 For Invoice Type b4repair. + I start the repairing process by click on "Start Repair" Button. - !workflow {model: mrp.repair, action: action_repair_start, ref: mrp_repair_rma2} - diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index b51b66a48e8..a9e1bac774d 100644 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -8,7 +8,7 @@ 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_stock + location_dest_id: stock.stock_location_14 location_id: stock.stock_location_stock name: '[PC1] Basic PC' product_id: product.product_product_pc1 @@ -17,7 +17,7 @@ product_uos_qty: 1.0 - | - I start by creating new Repair order for "Basic Pc" product. + 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 @@ -115,9 +115,5 @@ I check that Invoice is created for this repair order. - !python {model: mrp.repair}: | - obj_lines = self.pool.get('account.invoice.line') - inv_obj = self.pool.get('account.invoice') repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0] - invoice_ids = inv_obj.search(cr, uid, [('partner_id', '=', repair_id.partner_id.id)]) - invoice_id = inv_obj.browse(cr, uid, invoice_ids)[0] - assert repair_id.partner_id.id == invoice_id.partner_id.id, "No invoice existing for the same partner" + assert repair_id.invoice_id.id, _("No invoice exists for this repair order") From 3c0b78b90e999a7bf9f2099a14ba662739e82204 Mon Sep 17 00:00:00 2001 From: "Rucha (Open ERP)" Date: Tue, 27 Sep 2011 11:24:44 +0530 Subject: [PATCH 33/36] [FIX]: mrp: Fixed yml for change production qty wizard, added new step to check if qty has been changed successfully or not bzr revid: rpa@tinyerp.com-20110927055444-0tz2t25v49ou0exf --- addons/mrp/test/mrp_production_order.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/mrp/test/mrp_production_order.yml b/addons/mrp/test/mrp_production_order.yml index fecb7e31f1e..78b1b870473 100644 --- a/addons/mrp/test/mrp_production_order.yml +++ b/addons/mrp/test/mrp_production_order.yml @@ -36,10 +36,14 @@ Changes the Quantity of Product. - !python {model: change.production.qty}: | - context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_qty")], "tz": False, "active_id":ref('mrp_production_qty')} + context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_mo1")], "tz": False, "active_id":ref('mrp_production_mo1')} self.default_get(cr, uid, ["product_qty"], context) self.change_prod_qty(cr, uid, [ref("mrp_production_qty")], context=context) - + I check now quantity of the production order is 8 or not. +- + !assert {model: mrp.production, id: mrp_production_mo1}: + - product_qty == 8 - I am checking Procurement orders for components of PC1. - From 5a473c06e991bb792018433f930664553de1ef02 Mon Sep 17 00:00:00 2001 From: "Rucha (Open ERP)" Date: Tue, 27 Sep 2011 11:25:12 +0530 Subject: [PATCH 34/36] [IMP]: mrp: Typo Improvement bzr revid: rpa@tinyerp.com-20110927055512-uch08kfd8exyqogz --- addons/mrp_operations/test/mrp_operation_test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/mrp_operations/test/mrp_operation_test.yml b/addons/mrp_operations/test/mrp_operation_test.yml index 590811119d2..9cb81abebde 100644 --- a/addons/mrp_operations/test/mrp_operation_test.yml +++ b/addons/mrp_operations/test/mrp_operation_test.yml @@ -22,7 +22,7 @@ !python {model: mrp.production.workcenter.line}: | from tools.translate import _ order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo1')),('state','=','draft')]) - assert order_id, _('No Work order define for this production order!') + assert order_id, _('No work order defined for this production order!') - The scheduler runs. - @@ -35,7 +35,7 @@ !python {model: mrp.production}: | from tools.translate import _ pick_ids = self.browse(cr, uid, ref("mrp_production_mo1")) - assert pick_ids.picking_id.id, _('No Internal Pickings!') + assert pick_ids.picking_id.id, _('No Internal Picking generated!') - In order to cancel the MO, first cancel its picking - @@ -48,9 +48,9 @@ - !workflow {model: mrp.production, action: button_cancel, ref: mrp_production_mo1} - - I check that there is one Work order generated related to the production order that is cancel or not. + I check that there is one Work order generated related to the production order that is cancelled or not. - !python {model: mrp.production.workcenter.line}: | from tools.translate import _ order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo1')),('state','=','cancel')]) - assert order_id, _('Work order is not cancel for this production order!') \ No newline at end of file + assert order_id, _('Work order is not cancelled for this production order!') From 239100630058fc978f20f481cbf3f2dc6c2a2e30 Mon Sep 17 00:00:00 2001 From: "Rucha (Open ERP)" Date: Tue, 27 Sep 2011 14:42:08 +0530 Subject: [PATCH 35/36] [FIX]: mrp: Fixed flow of production process in yml bzr revid: rpa@tinyerp.com-20110927091208-sh8y3ye42thdwgc4 --- addons/mrp/test/mrp_production_order.yml | 45 +++++++++++++----------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/addons/mrp/test/mrp_production_order.yml b/addons/mrp/test/mrp_production_order.yml index 78b1b870473..f5b13ac5d22 100644 --- a/addons/mrp/test/mrp_production_order.yml +++ b/addons/mrp/test/mrp_production_order.yml @@ -28,10 +28,10 @@ - !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo1} - - I create record for producing products with quantity 8.00 + I create record for changing production quantity to 6.00 - !record {model: change.production.qty, id: mrp_production_qty}: - product_qty: 8.0 + product_qty: 6.0 - Changes the Quantity of Product. - @@ -40,10 +40,10 @@ self.default_get(cr, uid, ["product_qty"], context) self.change_prod_qty(cr, uid, [ref("mrp_production_qty")], context=context) - - I check now quantity of the production order is 8 or not. + I check now quantity of the production order is 6 or not. - !assert {model: mrp.production, id: mrp_production_mo1}: - - product_qty == 8 + - product_qty == 6 - I am checking Procurement orders for components of PC1. - @@ -68,28 +68,28 @@ pick_ids = self.search(cr, uid, [('type','=','internal')]) assert pick_ids, _('No Internal Pickings!') - - I see that there is a manufacturing order for the sub product of PC1 with ready state. + I see that there is a manufacturing order for the sub product CPU_GEN with ready state and I start production of it. - !python {model: mrp.production}: | from tools.translate import _ - order_ids = self.search(cr, uid, [('state','=','ready')]) + order_ids = self.search(cr, uid, [('state','=','ready'), ('product_id', '=', ref('product.product_product_cpu_gen'))]) assert order_ids, _('No manufacturing order in Ready state!') + import netsvc + wf_service = netsvc.LocalService("workflow") + for order in order_ids: + wf_service.trg_validate(uid, 'mrp.production', order, 'button_produce', cr) - - I start producing that product first. So I marked it as started. -- - !workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo1} -- - I create record for producing products with quantity 5.00. + I create record for producing products with quantity 6.00. - !record {model: mrp.product.produce, id: mrp_product_produce0}: - product_qty: 5.00 + product_qty: 6.00 mode: 'consume_produce' - I produce the product. - !python {model: mrp.product.produce}: | prod_obj = self.pool.get('mrp.production') - prod_ids = prod_obj.search(cr, uid, [('state','=','confirmed')]) + prod_ids = prod_obj.search(cr, uid, [('state','=','in_production'), ('product_id', '=', ref('product.product_product_cpu_gen'))]) self.do_produce(cr, uid, [ref('mrp_product_produce0')], context={'active_ids': prod_ids}) - Now the manufacturing order for subproduct CPU_GEN is done and manufacturing @@ -97,23 +97,26 @@ - !python {model: mrp.production}: | from tools.translate import _ - prod_ids = self.search(cr, uid, [('state','=','done')]) - assert prod_ids, _('Manufacturing order is yet not done!') + prod_ids = self.search(cr, uid, [('state','=','done'), ('product_id', '=', ref('product.product_product_cpu_gen'))]) + assert prod_ids, _('Manufacturing order for CPU_GEN is yet not done!') - I start producing the product PC1. - !workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo1} - - I create record for producing products with quantity 5.00. + I create record for producing products with quantity 6.00. - !record {model: mrp.product.produce, id: mrp_product_produce1}: - product_qty: 5.00 + product_qty: 6.00 mode: 'consume_produce' - Finally my production order is done. - !python {model: mrp.product.produce}: | - from tools.translate import _ - prod_obj = self.pool.get('mrp.production') - prod_ids = prod_obj.search(cr, uid, [('product_id.default_code','=','PC1')]) - self.do_produce(cr, uid, [ref('mrp_product_produce1')], context={'active_ids': prod_ids}) + context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_mo1")], "tz": False, "active_id":ref('mrp_production_mo1')} + self.do_produce(cr, uid, [ref('mrp_product_produce1')], context=context) +- + I check now the production order for PC1 is done. +- + !assert {model: mrp.production, id: mrp_production_mo1}: + - state == 'done' From 02bddc336bc870b3f8bdbfae55c74e32cd551b83 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 27 Sep 2011 15:17:24 +0530 Subject: [PATCH 36/36] [IMP]: onchange on product in bom bzr revid: ksa@tinyerp.com-20110927094724-jec0yn3osjjb00ef --- addons/mrp/test/mrp_phantom_bom.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/mrp/test/mrp_phantom_bom.yml b/addons/mrp/test/mrp_phantom_bom.yml index 6bb297fbcfb..7894fc81608 100644 --- a/addons/mrp/test/mrp_phantom_bom.yml +++ b/addons/mrp/test/mrp_phantom_bom.yml @@ -96,6 +96,12 @@ product_qty: 1.0 product_uom: product_uom_litre0 type: phantom +- + changes UOM and name if product change. +- + !python {model: mrp.bom}: | + production_id = self.browse(cr, uid, [ref('mrp_bom_orangejuice0')], context=context)[0] + self.onchange_product_id(cr, uid, [ref('mrp_bom_orangejuice0')], production_id.product_id.id, False) - I create bom lines for BoM for Orange Juice. -