bzr revid: qdp-launchpad@tinyerp.com-20110114001101-wk77opsrvslh7pak
115 lines
3.8 KiB
YAML
115 lines
3.8 KiB
YAML
-
|
|
In order to test the procurement with product type buy in OpenERP, I will create product
|
|
and then I will create procurement for this product.
|
|
-
|
|
I create product.
|
|
-
|
|
!record {model: product.product, id: product_product_cddrive0}:
|
|
categ_id: product.product_category_3
|
|
cost_method: standard
|
|
mes_type: fixed
|
|
name: CD drive
|
|
procure_method: make_to_order
|
|
supply_method: buy
|
|
type: product
|
|
seller_delay: '1'
|
|
standard_price: 100.0
|
|
supply_method: buy
|
|
uom_id: product.product_uom_unit
|
|
uom_po_id: product.product_uom_unit
|
|
volume: 0.0
|
|
warranty: 0.0
|
|
weight: 0.0
|
|
weight_net: 0.0
|
|
seller_delay: '1'
|
|
seller_ids:
|
|
- delay: 1
|
|
name: base.res_partner_asus
|
|
min_qty: 2.0
|
|
qty: 5.0
|
|
-
|
|
I create procurement order.
|
|
-
|
|
!record {model: procurement.order, id: procurement_order_testcase0}:
|
|
company_id: base.main_company
|
|
date_planned: !eval time.strftime('%Y-%m-%d %H:%M:%S')
|
|
location_id: stock.stock_location_stock
|
|
name: Test Case
|
|
priority: '1'
|
|
procure_method: make_to_order
|
|
product_id: product_product_cddrive0
|
|
product_qty: 5.0
|
|
product_uom: product.product_uom_unit
|
|
product_uos: product.product_uom_unit
|
|
product_uos_qty: 0.0
|
|
state: draft
|
|
-
|
|
I confirm on procurement order.
|
|
-
|
|
!workflow {model: procurement.order, action: button_confirm, ref: procurement_order_testcase0}
|
|
-
|
|
I run the scheduler.
|
|
-
|
|
!function {model: procurement.order, name: run_scheduler}:
|
|
- model: procurement.order
|
|
search: "[]"
|
|
-
|
|
I check that purchase order is generated.
|
|
-
|
|
!python {model: procurement.order}: |
|
|
from tools.translate import _
|
|
proc_ids = self.browse(cr, uid, [ref('procurement_order_testcase0')])[0]
|
|
assert(proc_ids.purchase_id), _('Purchase Order is not Created!')
|
|
-
|
|
I check the state is running.
|
|
-
|
|
!python {model: procurement.order}: |
|
|
from tools.translate import _
|
|
proc_ids = self.browse(cr, uid, [ref('procurement_order_testcase0')])[0]
|
|
assert(proc_ids.state == 'running'), _('Exception')
|
|
-
|
|
I confirm and Approve the purchase order.
|
|
-
|
|
!python {model: purchase.order}: |
|
|
procurement_obj = self.pool.get('procurement.order')
|
|
proc_ids = procurement_obj.browse(cr, uid, [ref('procurement_order_testcase0')])[0]
|
|
import netsvc
|
|
wf_service = netsvc.LocalService("workflow")
|
|
wf_service.trg_validate(uid, 'purchase.order',proc_ids.purchase_id.id,'purchase_confirm', cr)
|
|
-
|
|
I receive the order of the supplier ASUStek from the Incoming Shipments menu.
|
|
-
|
|
!python {model: stock.picking }: |
|
|
import time
|
|
procurement_obj = self.pool.get('procurement.order')
|
|
proc_ids = procurement_obj.browse(cr, uid, [ref('procurement_order_testcase0')])[0]
|
|
picking_ids = self.search(cr, uid, [('purchase_id', '=', proc_ids.purchase_id.id),('type','=','in')])
|
|
pickings = self.browse(cr, uid, picking_ids)
|
|
for picking in pickings:
|
|
move = picking.move_lines[0]
|
|
partial_datas = {
|
|
'partner_id': picking.address_id.partner_id.id,
|
|
'address_id': picking.address_id.id,
|
|
'delivery_date' : time.strftime('%Y-%m-%d')
|
|
}
|
|
partial_datas['move%s'%(move.id)]= {
|
|
'product_id': move.product_id,
|
|
'product_qty': move.product_qty,
|
|
'product_uom': move.product_uom.id,
|
|
}
|
|
self.do_partial(cr, uid, [picking.id], partial_datas)
|
|
-
|
|
I confirm the Reservation.
|
|
-
|
|
!python {model: stock.move }: |
|
|
procurement_obj = self.pool.get('procurement.order')
|
|
proc_ids = procurement_obj.browse(cr, uid, [ref('procurement_order_testcase0')])[0]
|
|
self.action_done(cr,uid,[proc_ids.move_id.id])
|
|
-
|
|
I check the state is Done.
|
|
-
|
|
!python {model: procurement.order}: |
|
|
from tools.translate import _
|
|
proc_ids = self.browse(cr, uid, [ref('procurement_order_testcase0')])[0]
|
|
assert(proc_ids.state == 'done'), _('Order is not in done state')
|