2 I update the price of the Ice-cream.
4 !python {model: stock.change.standard.price}: |
5 context.update({'active_model':'product.product', 'active_id': ref('product_icecream'), 'active_ids':[ref('product_icecream')]})
7 !record {model: stock.change.standard.price, id: change_price}:
10 !python {model: stock.change.standard.price}: |
11 self.change_price(cr, uid, [ref('change_price')], context=context)
13 I check price of Ice-cream after update price.
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."
19 I update the current stock of the Ice-cream with 10 kgm in Small Refrigerator in lot0.
21 !record {model: stock.change.product.qty, id: change_qty}:
22 location_id: location_refrigerator_small
24 product_id: product_icecream
25 prodlot_id: lot_icecream_1
27 !python {model: stock.change.product.qty}: |
28 self.change_product_qty(cr, uid, [ref('change_qty')], context=context)
30 I check available stock of Ice-cream after update stock.
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."
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')]})
41 !record {model: stock.inventory.merge, id: merge_inventory}:
43 !python {model: stock.inventory.merge }: |
44 self.do_merge(cr, uid, [ref('merge_inventory')], context=context)
48 !python {model: stock.inventory}: |
49 self.action_cancel_inventory(cr, uid, [ref('stock_inventory_icecream')])
51 I reset to draft inventory.
53 !python {model: stock.inventory}: |
54 self.action_cancel_draft(cr, uid, [ref('stock_inventory_icecream')])
56 I confirm physical inventory of Ice-cream which are came in different lots.
58 !python {model: stock.inventory}: |
59 self.action_confirm(cr, uid, [ref('stock_inventory_icecream')], context=context)
61 I check move details after confirmed physical inventory.
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."
77 I split inventory line.
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')]})
82 !record {model: stock.inventory.line.split, id: split_inventory_lot0}:
86 prodlot_id: lot_icecream_0
88 prodlot_id: lot_icecream_0
90 !python {model: stock.inventory.line.split }: |
91 self.split_lot(cr, uid, [ref('split_inventory_lot0')], context=context)
93 I fill inventory line.
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')]})
98 !record {model: stock.fill.inventory, id: fill_inventory}:
99 location_id: location_refrigerator
102 !python {model: stock.fill.inventory }: |
103 self.fill_inventory(cr, uid, [ref('fill_inventory')], context=context)
106 Now I check vitual stock of Ice-cream after confirmed physical inventory.
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."
112 I close physical inventory of Ice-cream.
114 !python {model: stock.inventory}: |
115 self.action_done(cr, uid, [ref('stock_inventory_icecream')], context=context)
117 I check closed move and real stock of Ice-cream after closed physical inventory.
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."
127 I check stock in lot.
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."