[ADD] purchase: Add the yml of procument

bzr revid: sbh@tinyerp.com-20100710082803-jsyzlbttjqdmfo7x
This commit is contained in:
sbh (Open ERP) 2010-07-10 13:58:03 +05:30
parent 60de30c62f
commit 6102a64b4f
2 changed files with 110 additions and 0 deletions

View File

@ -103,6 +103,7 @@
<record id="trans_confirmed_router" model="workflow.transition">
<field name="act_from" ref="act_confirmed"/>
<field name="act_to" ref="act_router"/>
<field name="signal">purchase_approve</field>
</record>
<record id="trans_router_picking" model="workflow.transition">
<field name="act_from" ref="act_router"/>

View File

@ -0,0 +1,109 @@
-
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
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
valuation: manual_periodic
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
seller_ids:
- delay: 1
name: base.res_partner_asus
qty: 5.0
-
I create procurement order.
-
!record {model: procurement.order, id: procurement_order_testcase0}:
company_id: base.main_company
date_planned: '2010-07-07 15:38:53'
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.
-
!workflow {model: procurement.order, action: button_check, ref: procurement_order_testcase0}
-
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)
wf_service.trg_validate(uid, 'purchase.order',proc_ids.purchase_id.id,'purchase_approve', 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_id = self.search(cr, uid, [('origin', '=', proc_ids.purchase_id.name)])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
move =pick.move_lines[0]
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.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')