2 In order to test "mrp_repair" module, I start with creating repair order, confirm it, and start repair.
5 Given that I have already stock move line created.
7 !record {model: stock.move, id: stock_move_pcbasicpc0}:
8 company_id: base.main_company
9 date: '2010-06-24 20:10:28'
10 date_expected: '2010-06-24 20:10:55'
11 location_dest_id: stock.stock_location_stock
12 location_id: stock.stock_location_stock
13 name: '[PC1] Basic PC'
14 product_id: product.product_product_pc1
16 product_uom: product.product_uom_unit
20 I start by creating new Repair order for "Basic Pc" product.
22 !record {model: mrp.repair, id: mrp_repair_rma0}:
23 address_id: base.res_partner_address_1
24 guarantee_limit: '2010-06-24'
25 invoice_method: 'after_repair'
26 partner_invoice_id: base.res_partner_address_1
27 location_dest_id: stock.stock_location_14
28 location_id: stock.stock_location_14
29 move_id: 'stock_move_pcbasicpc0'
32 - location_dest_id: stock.location_production
33 location_id: stock.stock_location_stock
34 name: '[HDD1] HDD Seagate 7200.8 80GB'
36 product_id: product.product_product_hdd1
37 product_uom: product.product_uom_unit
42 partner_id: base.res_partner_9
43 product_id: product.product_product_pc1
46 I check that Repair order is in "Draft" state.
48 !assert {model: mrp.repair, id: mrp_repair_rma0}:
52 I confirm This Repair order.
54 !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma0}
57 I start the repairing process by click on "Start Repair" Button.
59 !workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rma0}
62 I check that state is "Under Repair".
64 !assert {model: mrp.repair, id: mrp_repair_rma0}:
65 - state == 'under_repair'
67 Repairing Process for product is Done and I End Repair process by click on "End Repair" button.
69 !workflow {model: mrp.repair, action: action_repair_end, ref: mrp_repair_rma0}
71 I select invoiced after repair option in this "RMA00004" Repair order.
72 so I create Invoice by click on "Make Invoice" wizard.
74 !record {model: mrp.repair.make_invoice, id: mrp_repair_make_invoice_0}:
77 I click on "Create Invoice" button of this wizard to make invoice.
79 !python {model: mrp.repair.make_invoice}: |
80 self.make_invoices(cr, uid, [ref("mrp_repair_make_invoice_0")], {"active_ids": [ref("mrp_repair.mrp_repair_rma0")]})
82 I check that Invoice is created for this repair order.
84 !python {model: mrp.repair}: |
85 obj_lines = self.pool.get('account.invoice.line')
86 inv_obj = self.pool.get('account.invoice')
87 repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0]
88 invoice_ids = inv_obj.search(cr, uid, [('partner_id', '=', repair_id.partner_id.id)])
89 invoice_id = inv_obj.browse(cr, uid, invoice_ids)[0]
91 assert repair_id.partner_id.id == invoice_id.partner_id.id, "No invoice existing for the same partner"