132 lines
5.5 KiB
YAML
132 lines
5.5 KiB
YAML
-
|
|
I update the price of the Ice-cream.
|
|
-
|
|
!python {model: stock.change.standard.price}: |
|
|
context.update({'active_model':'product.product', 'active_id': ref('product_icecream'), 'active_ids':[ref('product_icecream')]})
|
|
-
|
|
!record {model: stock.change.standard.price, id: change_price}:
|
|
new_price: 120
|
|
-
|
|
!python {model: stock.change.standard.price}: |
|
|
self.change_price(cr, uid, [ref('change_price')], context=context)
|
|
-
|
|
I check price of Ice-cream after update price.
|
|
-
|
|
!python {model: product.product}: |
|
|
product = self.browse(cr, uid, ref('product_icecream'), context=context)
|
|
assert product.standard_price == 120, "Price is not updated."
|
|
-
|
|
I update the current stock of the Ice-cream with 10 kgm in Small Refrigerator in lot0.
|
|
-
|
|
!record {model: stock.change.product.qty, id: change_qty}:
|
|
location_id: location_refrigerator_small
|
|
new_quantity: 10
|
|
product_id: product_icecream
|
|
prodlot_id: lot_icecream_1
|
|
-
|
|
!python {model: stock.change.product.qty}: |
|
|
self.change_product_qty(cr, uid, [ref('change_qty')], context=context)
|
|
-
|
|
I check available stock of Ice-cream after update stock.
|
|
-
|
|
!python {model: product.product}: |
|
|
product = self.browse(cr, uid, ref('product_icecream'), context=context)
|
|
assert product.qty_available == 10, "Stock is not updated."
|
|
-
|
|
I merge inventory.
|
|
-
|
|
!python {model: stock.inventory.merge }: |
|
|
context.update({'active_model': 'stock.inventory', 'active_id': ref('stock_inventory_icecream'), 'active_ids': [ref('stock_inventory_icecream')]})
|
|
-
|
|
!record {model: stock.inventory.merge, id: merge_inventory}:
|
|
-
|
|
!python {model: stock.inventory.merge }: |
|
|
self.do_merge(cr, uid, [ref('merge_inventory')], context=context)
|
|
-
|
|
I cancel inventory.
|
|
-
|
|
!python {model: stock.inventory}: |
|
|
self.action_cancel_inventory(cr, uid, [ref('stock_inventory_icecream')])
|
|
-
|
|
I reset to draft inventory.
|
|
-
|
|
!python {model: stock.inventory}: |
|
|
self.action_cancel_draft(cr, uid, [ref('stock_inventory_icecream')])
|
|
-
|
|
I confirm physical inventory of Ice-cream which are came in different lots.
|
|
-
|
|
!python {model: stock.inventory}: |
|
|
self.action_confirm(cr, uid, [ref('stock_inventory_icecream')], context=context)
|
|
-
|
|
I check move details after confirmed physical inventory.
|
|
-
|
|
!python {model: stock.inventory}: |
|
|
inventory = self.browse(cr, uid, ref('stock_inventory_icecream'), context=context)
|
|
assert len(inventory.move_ids) == len(inventory.inventory_line_id), "moves are not correspond."
|
|
for move_line in inventory.move_ids:
|
|
for line in inventory.inventory_line_id:
|
|
if move_line.product_id.id == line.product_id.id and move_line.prodlot_id.id == line.prod_lot_id.id:
|
|
location_id = line.product_id.property_stock_inventory.id
|
|
assert move_line.product_qty == line.product_qty, "Qty is not correspond."
|
|
assert move_line.product_uom.id == line.product_uom.id, "UOM is not correspond."
|
|
assert move_line.date == inventory.date, "Date is not correspond."
|
|
assert move_line.location_id.id == location_id, "Source location is not correspond."
|
|
assert move_line.location_dest_id.id == line.location_id.id, "Destination location is not correspond."
|
|
assert move_line.state == 'confirmed', "Move is not confirmed."
|
|
-
|
|
I split inventory line.
|
|
-
|
|
!python {model: stock.inventory.line.split}: |
|
|
context.update({'active_model': 'stock.inventory.line', 'active_id': ref('stock_inventory_line_icecream_lot0'), 'active_ids': [ref('stock_inventory_line_icecream_lot0')]})
|
|
-
|
|
!record {model: stock.inventory.line.split, id: split_inventory_lot0}:
|
|
use_exist: True
|
|
line_exist_ids:
|
|
- quantity: 6
|
|
prodlot_id: lot_icecream_0
|
|
- quantity: 4
|
|
prodlot_id: lot_icecream_0
|
|
-
|
|
!python {model: stock.inventory.line.split }: |
|
|
self.split_lot(cr, uid, [ref('split_inventory_lot0')], context=context)
|
|
-
|
|
I fill inventory line.
|
|
-
|
|
!python {model: stock.fill.inventory}: |
|
|
context.update({'active_model': 'stock.inventory', 'active_id': ref('stock_inventory_icecream'), 'active_ids': [ref('stock_inventory_icecream')]})
|
|
-
|
|
!record {model: stock.fill.inventory, id: fill_inventory}:
|
|
location_id: location_refrigerator
|
|
recursive: True
|
|
-
|
|
!python {model: stock.fill.inventory }: |
|
|
self.fill_inventory(cr, uid, [ref('fill_inventory')], context=context)
|
|
|
|
-
|
|
Now I check vitual stock of Ice-cream after confirmed physical inventory.
|
|
-
|
|
!python {model: product.product}: |
|
|
product = self.browse(cr, uid, ref('product_icecream'), context=context)
|
|
assert product.virtual_available == 100, "Vitual stock is not updated."
|
|
-
|
|
I close physical inventory of Ice-cream.
|
|
-
|
|
!python {model: stock.inventory}: |
|
|
self.action_done(cr, uid, [ref('stock_inventory_icecream')], context=context)
|
|
-
|
|
I check closed move and real stock of Ice-cream after closed physical inventory.
|
|
-
|
|
!python {model: stock.inventory}: |
|
|
inventory = self.browse(cr, uid, ref('stock_inventory_icecream'), context=context)
|
|
assert inventory.state == 'done', "inventory is not closed."
|
|
for move_line in inventory.move_ids:
|
|
assert move_line.state == 'done', "Move is not closed."
|
|
product = self.pool.get('product.product').browse(cr, uid, ref('product_icecream'), context=context)
|
|
product.qty_available == 100, "Real stock is not updated."
|
|
-
|
|
I check stock in lot.
|
|
-
|
|
!python {model: stock.production.lot}: |
|
|
lot = self.browse(cr, uid, ref('lot_icecream_0'), context=context)
|
|
assert lot.stock_available == 50, "Stock in lot is not correspond."
|