From 44f3e6de6674818ab42ff667bc1b066ed7d830c5 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Fri, 24 Jan 2014 13:30:36 +0100 Subject: [PATCH] [IMP] Adapt demo data and tests mrp repair bzr revid: jco@openerp.com-20140124123036-w63uzmrkg08qoil0 --- addons/mrp_repair/mrp_repair.py | 2 +- addons/mrp_repair/mrp_repair_demo.yml | 59 ++++--------------- .../test/test_mrp_repair_noneinv.yml | 7 +-- 3 files changed, 14 insertions(+), 54 deletions(-) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 66325ee500c..80882cd80ef 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -480,7 +480,7 @@ class mrp_repair(osv.osv): move_id = move_obj.create(cr, uid, { 'name': repair.name, 'product_id': repair.product_id.id, - 'product_uom': repair.product_uom.id, + 'product_uom': repair.product_uom.id or repair.product_id.uom_id.id, 'product_qty': repair.product_qty, 'partner_id': repair.address_id and repair.address_id.id or False, 'location_id': repair.location_id.id, diff --git a/addons/mrp_repair/mrp_repair_demo.yml b/addons/mrp_repair/mrp_repair_demo.yml index 1299cbfb6d2..f9f0eaf03f8 100644 --- a/addons/mrp_repair/mrp_repair_demo.yml +++ b/addons/mrp_repair/mrp_repair_demo.yml @@ -1,25 +1,13 @@ -- - !record {model: stock.move, id: stock_move_pcbasicpc0}: - company_id: base.main_company - date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - date_expected: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - location_dest_id: stock.stock_location_14 - location_id: stock.stock_location_stock - name: '[PCSC234] PC Assemble SC234' - product_id: product.product_product_3 - product_qty: 1.0 - product_uom: product.product_uom_unit - product_uos_qty: 1.0 - !record {model: mrp.repair, id: mrp_repair_rmrp1}: address_id: base.res_partner_address_1 guarantee_limit: !eval datetime.today().strftime("%Y-%m-%d") invoice_method: 'none' + product_id: product.product_product_3 + product_uom: product.product_uom_unit partner_invoice_id: base.res_partner_address_1 location_dest_id: stock.stock_location_14 - location_id: stock.stock_location_14 - picking_type_id: stock.picking_type_out - move_id: 'stock_move_pcbasicpc0' + location_id: stock.stock_location_stock name: RMA00004 operations: - location_dest_id: stock.location_production @@ -39,29 +27,16 @@ product_uom: product.product_uom_unit price_unit: 50.0 partner_id: base.res_partner_9 - product_id: product.product_product_3 -- - !record {model: stock.move, id: stock.stock_move_stockmvmrp1}: - company_id: base.main_company - date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - date_expected: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - location_dest_id: stock.stock_location_14 - location_id: stock.stock_location_stock - name: '[PC-DEM] PC on Demand' - product_id: product.product_product_5 - product_qty: 1.0 - product_uom: product.product_uom_unit - product_uos_qty: 1.0 - !record {model: mrp.repair, id: mrp_repair_rmrp0}: + product_id: product.product_product_5 + product_uom: product.product_uom_unit address_id: base.res_partner_address_1 guarantee_limit: !eval datetime.today().strftime("%Y-%m-%d") invoice_method: 'after_repair' partner_invoice_id: base.res_partner_address_1 location_dest_id: stock.stock_location_14 - location_id: stock.stock_location_14 - picking_type_id: stock.picking_type_out - move_id: 'stock.stock_move_stockmvmrp1' + location_id: stock.stock_location_stock name: RMA-00007 operations: - location_dest_id: stock.location_production @@ -81,29 +56,16 @@ product_uom: product.product_uom_unit price_unit: 50.0 partner_id: base.res_partner_9 - product_id: product.product_product_5 -- - !record {model: stock.move, id: stock.stock_move_stockmvmrp2}: - company_id: base.main_company - date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - date_expected: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S") - location_dest_id: stock.stock_location_14 - location_id: stock.stock_location_stock - name: '[LCD15] 15” LCD Monitor' - product_id: product.product_product_6 - product_qty: 1.0 - product_uom: product.product_uom_unit - product_uos_qty: 1.0 - !record {model: mrp.repair, id: mrp_repair_rmrp2}: + product_id: product.product_product_6 + product_uom: product.product_uom_unit 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_dest_id: stock.stock_location_stock location_id: stock.stock_location_14 - picking_type_id: stock.picking_type_out - move_id: 'stock.stock_move_stockmvmrp2' name: RMA-00011 operations: - location_dest_id: stock.location_production @@ -122,5 +84,4 @@ 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_6 + partner_id: base.res_partner_9 \ No newline at end of file diff --git a/addons/mrp_repair/test/test_mrp_repair_noneinv.yml b/addons/mrp_repair/test/test_mrp_repair_noneinv.yml index 4485069dc01..53a392b6bee 100644 --- a/addons/mrp_repair/test/test_mrp_repair_noneinv.yml +++ b/addons/mrp_repair/test/test_mrp_repair_noneinv.yml @@ -8,7 +8,7 @@ - !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rmrp1} - - I start the repairing process by clicking on "Start Repair" button for Invoice Method 'No Invoice'. + I start the repairing process by clicking on "Start Repair" button for Invoice Method 'No Invoice'. - !workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rmrp1} - @@ -22,9 +22,8 @@ !workflow {model: mrp.repair, action: action_repair_end, ref: mrp_repair_rmrp1} - I define Invoice Method 'No Invoice' option in this repair order. - So, I check that Invoice should not be created for this repair order. + So, I check that Invoice has not been created for this repair order. - !python {model: mrp.repair}: | repair_id = self.browse(cr, uid, [ref('mrp_repair_rmrp1')], context=context)[0] - assert not repair_id.invoice_id.id, "Invoice should not exist for this repair order" - + assert not repair_id.invoice_id.id, "Invoice should not exist for this repair order" \ No newline at end of file