odoo/addons/stock_location/test/stock_location_push_flow.yml

131 lines
4.6 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 product category.
-
!record {model: product.category, id: product_category_computer0}:
name: Computer
-
I create Supplier.
-
!record {model: res.partner, id: res_partner_microlinktechnologies0}:
street: Kailash Vaibhav, Parksite
name: Micro Link Technologies
property_account_payable: account_account_payable0
property_account_receivable: account_account_receivable0
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: product.product, id: product_product_hpcdwriters01}:
categ_id: product_category_computer0
cost_method: standard
list_price: 1000.0
mes_type: fixed
name: HP CD writers
procure_method: make_to_stock
seller_ids:
- delay: 1
name: res_partner_microlinktechnologies0
min_qty: 5.0
path_ids:
- auto: auto
invoice_state: none
location_dest_id: stock_location.stock_location_qualitytest0
location_from_id: stock.stock_location_stock
- auto: auto
invoice_state: none
location_dest_id: stock.stock_location_components
location_from_id: stock_location.stock_location_qualitytest0
supply_method: buy
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
invoice_state: none
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_qty: 6.0
product_uom: product.product_uom_unit
product_uos_qty: 6.0
name: Pushed Flow Test
type: in
-
I confirm picking.
-
!python {model: stock.picking }: |
self.draft_force_assign(cr, uid, [ref("stock_picking_in0")], {"lang": "en_US",
"search_default_available": 1, "tz": False, "active_model": "ir.ui.menu",
"contact_display": "partner_address", "active_ids": [ref("stock.menu_action_picking_tree4")],
"active_id": ref("stock.menu_action_picking_tree4"), })
-
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 }: |
from tools.translate import _
picking_id = self.search(cr, uid, [('origin','=','Pushed Flow Test'),('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')),('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 }: |
from tools.translate import _
picking_id = self.search(cr, uid, [('origin','=','Pushed Flow Test'),('type','=','out')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
assert(pick.state == 'done'), _('Picking is not in done state')