[MERGE] lp:~xrg/openobject-addons/trunk-patch18
[odoo/odoo.git] / addons / mrp_repair / test / test_mrp_repair.yml
1 - |
2   In order to test "mrp_repair" module, I start with creating repair order, confirm it, and start repair.
3
4 - |
5   Given that I have already  stock move line created.
6
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
15     product_qty: 1.0
16     product_uom: product.product_uom_unit
17     product_uos_qty: 1.0
18  
19 - |
20   I start by creating new Repair order for "Basic Pc" product.
21
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'
30     name: RMA00004
31     operations:
32       - location_dest_id: stock.location_production
33         location_id: stock.stock_location_stock
34         name: '[HDD1] HDD Seagate 7200.8 80GB'
35         price_unit: 50.0
36         product_id: product.product_product_hdd1
37         product_uom: product.product_uom_unit
38         product_uom_qty: 1.0
39         state: draft
40         to_invoice: 1
41         type: add
42     partner_id: base.res_partner_9
43     product_id: product.product_product_pc1
44     
45 - |
46   I check that Repair order is in "Draft" state.
47
48   !assert {model: mrp.repair, id: mrp_repair_rma0}:
49       - state == 'draft'
50
51 - |
52   I confirm This Repair order.
53
54   !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma0}      
55
56 - |
57   I start the repairing  process by   click on "Start Repair" Button.
58 -
59   !workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rma0}
60  
61 - |
62   I check that state is "Under Repair".
63 -
64   !assert {model: mrp.repair, id: mrp_repair_rma0}:
65       - state == 'under_repair'
66 - |
67   Repairing Process for product is Done and I End Repair process by click on "End Repair" button.
68 -
69   !workflow {model: mrp.repair, action: action_repair_end, ref: mrp_repair_rma0}
70 - |
71   I select invoiced after repair option in this "RMA00004" Repair order.
72   so I create Invoice by click on "Make Invoice" wizard.
73
74   !record {model: mrp.repair.make_invoice, id: mrp_repair_make_invoice_0}:
75     group: 1
76 - |
77   I click on "Create Invoice" button of this wizard to make invoice.
78
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")]})
81 - |
82   I check that Invoice is created for this repair order.
83 -
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]
90      
91      assert repair_id.partner_id.id == invoice_id.partner_id.id, "No invoice existing for the same partner"