[FIX] stock: typo incomming -> incoming in demo & tests
[odoo/odoo.git] / addons / stock / test / shipment.yml
1 -
2    Stock manager can only test whole process related to Shipment, so we check data with stock manager.
3 -
4   !context
5     uid: 'res_users_stock_manager'
6 -
7   I confirm incoming move of 50 kgm Ice-cream
8 -
9   !python {model: stock.move}: |
10       incoming_move = self.browse(cr, uid, ref("incomming_shipment_icecream"))
11       self.action_confirm(cr, uid, [incoming_move.id])
12 -
13   I receive 40kgm Ice-cream so It will make backorder of incomming shipment for 10 kgm.
14 -
15   !python {model: stock.picking}: |
16     pick = self.browse(cr, uid, ref("incomming_shipment"), context=context)
17     self.pool.get('stock.pack.operation').create(cr, uid, {
18         'picking_id': pick.id,
19         'product_id': ref('product_icecream'),
20         'product_uom_id': ref('product.product_uom_kgm'),
21         'product_qty': 40,
22         'location_id': ref('stock.stock_location_suppliers'),
23         'location_dest_id': ref('stock.stock_location_14')
24     })
25     context.update({'active_model': 'stock.picking', 'active_id': ref('incomming_shipment'), 'active_ids': [ref('incomming_shipment')]})
26     pick = self.browse(cr, uid, pick.id, context=context)
27     pick.do_transfer()
28 -
29   I check backorder shipment after received partial shipment and check remaining shipment.
30 -
31   !python {model: stock.picking}: |
32     shipment = self.browse(cr, uid, ref("incomming_shipment"))
33     for move_line in shipment.move_lines:
34         assert move_line.product_qty == 40, "Qty in shipment does not correspond."
35         assert move_line.state == 'done', "Move line of shipment should be closed."
36     backorder_id = self.search(cr, uid, [('backorder_id', '=', ref("incomming_shipment"))],context=context)
37     backorder = self.browse(cr, uid, backorder_id)[0]
38     for move_line in backorder.move_lines:
39         assert move_line.product_qty == 10, "Qty in backorder does not correspond."
40         assert (move_line.state == 'assigned' or move_line.state == 'waiting' or move_line.state == 'confirmed'), "Move line of backorder should be assigned, confirmed or waiting."
41     context.update({'active_model': 'stock.picking', 'active_id': backorder_id[0], 'active_ids': backorder_id})
42 -
43   I receive the remaining 10kgm Ice-cream from the backorder.
44 -
45   !python {model: stock.picking}: |
46     backorder_id = self.search(cr, uid, [('backorder_id', '=', ref("incomming_shipment"))],context=context)
47     backorder = self.browse(cr, uid, backorder_id, context=context)[0]
48     self.pool.get('stock.pack.operation').create(cr, uid, {
49         'picking_id': backorder.id,
50         'product_id': ref('product_icecream'),
51         'product_uom_id': ref('product.product_uom_kgm'),
52         'product_qty': 10,
53         'location_id': ref('stock.stock_location_suppliers'),
54         'location_dest_id': ref('stock.stock_location_14')
55     })
56     backorder.do_transfer()
57 -
58   I check incomming shipment after receipt.
59 -
60   !python {model: stock.picking}: |
61     shipment = self.browse(cr, uid, self.search(cr, uid, [('backorder_id', '=', ref("incomming_shipment"))]))[0]
62     assert shipment.state == 'done', "shipment should be close after received."
63     for move_line in shipment.move_lines:
64         assert move_line.state == 'done', "Move line should be closed."