odoo/addons/stock_location/test/stock_location_push_flow.yml

117 lines
4.3 KiB
YAML

-
In order to test the product pushed flow , I create account ,partner,product,shipment
Push flow specification indicates which location is chained with which location.
-
I create Supplier.
-
!record {model: res.partner, id: res_partner_microlinktechnologies0}:
street: Kailash Vaibhav, Parksite
name: Micro Link Technologies
supplier: true
is_company: true
-
I create Supplier address.
-
!record {model: res.partner, id: res_partner_address_0}:
name: Micro Link Technologies
country_id: base.in
parent_id: res_partner_microlinktechnologies0
street: Ash House, Ash Road
title: base.res_partner_title_miss
-
I create product and define the pushed flow .
-
I set the chain location Supplier to stock Input
Stock Input to Quality test and Quality test -Stock .
-
!record {model: stock.location.route, id: stock_location_route_push}:
name: 'Push'
push_ids:
- invoice_state: none
location_dest_id: stock_location.stock_location_qualitytest0
location_from_id: stock.stock_location_stock
picking_type_id: stock.picking_type_internal
- invoice_state: none
location_dest_id: stock.stock_location_components
location_from_id: stock_location.stock_location_qualitytest0
picking_type_id: stock.picking_type_internal
-
!record {model: product.product, id: product_product_hpcdwriters01}:
list_price: 1000.0
mes_type: fixed
name: HP CD writers
seller_ids:
- delay: 1
name: res_partner_microlinktechnologies0
min_qty: 5.0
route_ids: [stock_location_route_push]
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
-
In order to test pushed flow .I buy the product from Micro Link Technologies supplier. I create a Picking.
-
!record {model: stock.picking , id: stock_picking_in0}:
partner_id: res_partner_address_0
company_id: base.main_company
move_lines:
- date_expected: !eval time.strftime('%Y-%m-%d %H:%M:%S')
location_dest_id: stock.stock_location_stock
location_id: stock.stock_location_suppliers
name: 'HP CD writers'
product_id: product_product_hpcdwriters01
product_uom_qty: 6.0
product_uom: product.product_uom_unit
product_uos_qty: 6.0
name: Pushed Flow Test
picking_type_id: stock.picking_type_in
-
I confirm picking.
-
!python {model: stock.picking }: |
self.force_assign(cr, uid, [ref("stock_picking_in0")], {})
-
I check that the outgoing order of the supplier is create with two move line.
Stock/Input To Quality test and Quality test To Stock.
-
I check the move is in waiting state.
-
!python {model: stock.picking }: |
picking_id = self.search(cr, uid, [('origin','=','Pushed Flow Test'),('picking_type_id','=',ref('stock.picking_type_out'))])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
for move in pick.move_lines:
assert(move.state == 'waiting'), 'Stock is not in waiting state'
-
I receive the order of the supplier Micro Link Technologies from the Incoming Shipments menu.
-
!python {model: stock.picking }: |
import time
picking_id = self.search(cr, uid, [('partner_id','=',ref('res_partner_microlinktechnologies0')),('picking_type_id','=',ref('stock.picking_type_in'))])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
move =pick.move_lines[0]
partial_datas = {
'partner_id':pick.partner_id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id.id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, picking_id,partial_datas)
-
I check the Outgoing Orders is automatically done.
-
!python {model: stock.picking }: |
picking_id = self.search(cr, uid, [('origin','=','Pushed Flow Test'),('picking_type_id','=',ref('stock.picking_type_out'))])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
assert(pick.state == 'done'), 'Picking is not in done state'