[REM]: unuse variable name and method
[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: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
10     date_expected: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
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: !eval datetime.today().strftime("%Y-%m-%d")
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     fees_lines:
43       - name: 'HDD1 Seagate repair fees'
44         product_id: product.product_product_hdd1
45         product_uom_qty: 1.0
46         product_uom: product.product_uom_unit
47         price_unit: 50.0
48     partner_id: base.res_partner_9
49     product_id: product.product_product_pc1
50
51 - |
52   I check that Repair order is in "Draft" state.
53 -
54   !assert {model: mrp.repair, id: mrp_repair_rma0}:
55       - state == 'draft'
56
57 - |
58   I confirm This Repair order.
59 -
60   !workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma0}
61
62 - |
63   I start the repairing  process by click on "Start Repair" Button For Invoice Type b4repair.
64 -
65   !workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rma0}
66
67 - |
68   I check that state is "Under Repair".
69 -
70   !assert {model: mrp.repair, id: mrp_repair_rma0}:
71       - state == 'under_repair'
72 - |
73   Repairing Process for product is Done and I End Repair process by click on "End Repair" button.
74 -
75   !workflow {model: mrp.repair, action: action_repair_end, ref: mrp_repair_rma0}
76
77 - |
78   I select invoiced after repair option in this "RMA00004" Repair order.
79   so I create Invoice by click on "Make Invoice" wizard.
80 -
81   !record {model: mrp.repair.make_invoice, id: mrp_repair_make_invoice_0}:
82     group: 1
83 - |
84   I click on "Create Invoice" button of this wizard to make invoice.
85 -
86   !python {model: mrp.repair.make_invoice}: |
87     self.make_invoices(cr, uid, [ref("mrp_repair_make_invoice_0")], {"active_ids": [ref("mrp_repair.mrp_repair_rma0")]})
88 - |
89   I check that Invoice is created for this repair order.
90 -
91   !python {model: mrp.repair}: |
92      obj_lines = self.pool.get('account.invoice.line')
93      inv_obj = self.pool.get('account.invoice')
94      repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0]
95      invoice_ids = inv_obj.search(cr, uid, [('partner_id', '=', repair_id.partner_id.id)])
96      invoice_id = inv_obj.browse(cr, uid, invoice_ids)[0]
97
98      assert repair_id.partner_id.id == invoice_id.partner_id.id, "No invoice existing for the same partner"
99 - |
100   On change of product sets some values
101 -
102   !python {model: mrp.repair}: |
103     self.onchange_product_id(cr, uid, [ref('mrp_repair_rma0')], product_id=False)
104 - |
105   Cancels repair order.
106 -
107   !python {model: mrp.repair}: |
108     self.action_cancel(cr, uid, [ref('mrp_repair_rma0')], context=None)
109 - |
110   Cancels repair order when it is in 'Draft' state
111 -
112   !python {model: mrp.repair}: |
113     self.action_cancel_draft(cr, uid, [ref('mrp_repair_rma0')])
114 - |
115   Writes repair order state to 'Ready'.
116 -
117   !python {model: mrp.repair}: |
118     self.action_repair_ready(cr, uid, [ref('mrp_repair_rma0')], context=None)
119 - |
120   Writes repair order state to 'Exception in invoice'
121 -
122   !python {model: mrp.repair}: |
123     self.action_invoice_cancel(cr, uid, [ref('mrp_repair_rma0')], context=None)
124 - |
125   Creates stock move and picking for repair order
126 -
127   !python {model: mrp.repair}: |
128     self.wkf_repair_done(cr, uid, [ref('mrp_repair_rma0')])
129 - |
130   On change of move id sets values of guarantee limit, source location, destination location, partner and partner address.
131 -
132   !python {model: mrp.repair}: |
133     repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0]
134     self.onchange_move_id(cr, uid, [ref('mrp_repair_rma0')], False, repair_id.move_id)
135 - |
136   On change of operation type it sets source location, destination location and to invoice field
137 -
138   !python {model: mrp.repair.line}: |
139     self.onchange_operation_type(cr, uid, [ref('mrp_repair_rma0')], type, False)
140 - |
141   On change of partner sets the values of partner address, partner invoice address and pricelist.
142 -
143   !python {model: mrp.repair}: |
144     repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0]
145     self.onchange_partner_id(cr, uid, [ref('mrp_repair_rma0')], False, repair_id.address_id)
146 - |
147   On change of production lot sets the values of source location, destination location, move and guarantee limit
148 -
149   !python {model: mrp.repair}: |
150     repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0]
151     self.onchange_lot_id(cr, uid, [ref('mrp_repair_rma0')], False, repair_id.product_id)