0cb6c0b78adbd95738c6cf76d9b019450e0d254c
[odoo/odoo.git] / addons / stock / test / opening_stock.yml
1 -
2   I update the price of the Ice-cream.
3 -
4   !python {model: stock.change.standard.price}: |
5     context.update({'active_model':'product.product', 'active_id': ref('product_icecream'), 'active_ids':[ref('product_icecream')]})
6 -
7   !record {model: stock.change.standard.price, id: change_price}:
8     new_price: 120
9 -
10   !python {model: stock.change.standard.price}: |
11     self.change_price(cr, uid, [ref('change_price')], context=context)
12 -
13   I check price of Ice-cream after update price.
14 -
15   !python {model: product.product}: |
16     product = self.browse(cr, uid, ref('product_icecream'), context=context)
17     assert product.standard_price == 120, "Price is not updated."
18 -
19   I update the current stock of the Ice-cream with 10 kgm in Small Refrigerator in lot0.
20 -
21   !record {model: stock.change.product.qty, id: change_qty}:
22     location_id: location_refrigerator_small
23     new_quantity: 10
24     product_id: product_icecream
25     prodlot_id: lot_icecream_1
26 -
27   !python {model: stock.change.product.qty}: |
28     self.change_product_qty(cr, uid, [ref('change_qty')], context=context)
29 -
30   I check available stock of Ice-cream after update stock.
31 -
32   !python {model: product.product}: |
33     product = self.browse(cr, uid, ref('product_icecream'), context=context)
34     assert product.qty_available == 10, "Stock is not updated."
35 -
36   I merge inventory.
37 -
38   !python {model: stock.inventory.merge }: |
39     context.update({'active_model': 'stock.inventory', 'active_id': ref('stock_inventory_icecream'), 'active_ids': [ref('stock_inventory_icecream')]})
40 -
41   !record {model: stock.inventory.merge, id: merge_inventory}:
42 -
43   !python {model: stock.inventory.merge }: |
44     self.do_merge(cr, uid, [ref('merge_inventory')], context=context)
45 -
46   I cancel inventory.
47 -
48   !python {model: stock.inventory}: |
49    self.action_cancel_inventory(cr, uid, [ref('stock_inventory_icecream')])
50 -
51   I reset to draft inventory.
52 -
53   !python {model: stock.inventory}: |
54     self.action_cancel_draft(cr, uid, [ref('stock_inventory_icecream')])
55 -
56   I confirm physical inventory of Ice-cream which are came in different lots.
57 -
58   !python {model: stock.inventory}: |
59     self.action_confirm(cr, uid, [ref('stock_inventory_icecream')], context=context)
60 -
61   I check move details after confirmed physical inventory.
62 -
63   !python {model: stock.inventory}: |
64     inventory = self.browse(cr, uid, ref('stock_inventory_icecream'), context=context)
65     assert len(inventory.move_ids) == len(inventory.inventory_line_id), "moves are not correspond."
66     for move_line in inventory.move_ids:
67         for line in inventory.inventory_line_id:
68             if move_line.product_id.id == line.product_id.id and move_line.prodlot_id.id == line.prod_lot_id.id:
69                 location_id = line.product_id.product_tmpl_id.property_stock_inventory.id
70                 assert move_line.product_qty == line.product_qty, "Qty is not correspond."
71                 assert move_line.product_uom.id == line.product_uom.id, "UOM is not correspond."
72                 assert move_line.date == inventory.date, "Date is not correspond."
73                 assert move_line.location_id.id == location_id, "Source location is not correspond."
74                 assert move_line.location_dest_id.id == line.location_id.id, "Destination location is not correspond."
75                 assert move_line.state == 'confirmed', "Move is not confirmed."
76 -
77   I split inventory line.
78 -
79   !python {model: stock.inventory.line.split}: |
80     context.update({'active_model': 'stock.inventory.line', 'active_id': ref('stock_inventory_line_icecream_lot0'), 'active_ids': [ref('stock_inventory_line_icecream_lot0')]})
81 -
82   !record {model: stock.inventory.line.split, id: split_inventory_lot0}:
83     use_exist: True
84     line_exist_ids:
85         - quantity: 6
86           prodlot_id: lot_icecream_0
87         - quantity: 4
88           prodlot_id: lot_icecream_0
89 -
90   !python {model: stock.inventory.line.split }: |
91     self.split_lot(cr, uid, [ref('split_inventory_lot0')], context=context)
92 -
93   I fill inventory line.
94 -
95   !python {model: stock.fill.inventory}: |
96     context.update({'active_model': 'stock.inventory', 'active_id': ref('stock_inventory_icecream'), 'active_ids': [ref('stock_inventory_icecream')]})
97 -
98   !record {model: stock.fill.inventory, id: fill_inventory}:
99     location_id: location_refrigerator
100     recursive: True
101 -
102   !python {model: stock.fill.inventory }: |
103     self.fill_inventory(cr, uid, [ref('fill_inventory')], context=context)
104
105 -
106   Now I check vitual stock of Ice-cream after confirmed physical inventory.
107 -
108   !python {model: product.product}: |
109     product = self.browse(cr, uid, ref('product_icecream'), context=context)
110     assert product.virtual_available == 100, "Vitual stock is not updated."
111 -
112   I close physical inventory of Ice-cream.
113 -
114   !python {model: stock.inventory}: |
115     self.action_done(cr, uid, [ref('stock_inventory_icecream')], context=context)
116 -
117   I check closed move and real stock of Ice-cream after closed physical inventory.
118 -
119   !python {model: stock.inventory}: |
120     inventory = self.browse(cr, uid, ref('stock_inventory_icecream'), context=context)
121     assert inventory.state == 'done', "inventory is not closed."
122     for move_line in inventory.move_ids:
123         assert move_line.state == 'done', "Move is not closed."
124     product = self.pool.get('product.product').browse(cr, uid, ref('product_icecream'), context=context)
125     product.qty_available == 100, "Real stock is not updated."
126 -
127   I check stock in lot.
128 -
129   !python {model: stock.production.lot}: |
130     lot = self.browse(cr, uid, ref('lot_icecream_0'), context=context)
131     assert lot.stock_available == 50, "Stock in lot is not correspond."