[ADD,IMP] purchase_requisition:
[ADD]Add New file for define the main flow of exclusive requisition "purchase_requisition_exclusive.yml" [IMP]Improve the demo data for exclisive code improvement [IMP]Add one new file in __openerp__.py bzr revid: dbr@tinyerp.com-20111102073552-yruxrxuvb9qji3pg
This commit is contained in:
parent
a8b7872502
commit
f45e2468bc
|
@ -45,6 +45,7 @@ This new object will regroup and will allow you to easily keep track and order a
|
|||
"active": False,
|
||||
"test":[
|
||||
'test/process/purchase_requisition.yml',
|
||||
'test/process/purchase_requisition_exclusive.yml',
|
||||
'test/process/cancel_purchase_requisition.yml',
|
||||
'test/ui/onchange_events.yml',
|
||||
'test/ui/purchase_requisition_report.yml',
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<record id="order_purchase_requisition1" model="purchase.requisition">
|
||||
<field name="user_id" model="res.users"/>
|
||||
<field name="exclusive">multiple</field>
|
||||
<field name="exclusive">exclusive</field>
|
||||
<field name="date_start" eval="time.strftime('%Y/%m/%d %H:%M:%S')"/>
|
||||
<field name="warehouse_id" ref="stock.stock_warehouse_shop0"/>
|
||||
</record>
|
||||
|
@ -24,6 +24,46 @@
|
|||
<field name="product_qty">5</field>
|
||||
</record>
|
||||
|
||||
<!--Resource: purchase.order-->
|
||||
|
||||
<record id="requisition_order1" model="purchase.order">
|
||||
<field name="location_id" ref="stock.stock_location_stock"/>
|
||||
<field name="pricelist_id" ref="purchase.list0"/>
|
||||
<field name="partner_id" ref="base.res_partner_4"/>
|
||||
<field name="partner_address_id" ref="base.res_partner_address_7"/>
|
||||
<field name="requisition_id" ref="order_purchase_requisition1"/>
|
||||
</record>
|
||||
|
||||
<record id="requisition_order2" model="purchase.order">
|
||||
<field name="location_id" ref="stock.stock_location_stock"/>
|
||||
<field name="pricelist_id" ref="purchase.list0"/>
|
||||
<field name="partner_id" ref="base.res_partner_vickingdirect0"/>
|
||||
<field name="partner_address_id" ref="base.res_partner_address_brussels0"/>
|
||||
<field name="requisition_id" ref="order_purchase_requisition1"/>
|
||||
</record>
|
||||
|
||||
<!--Resource: purchase.order.line-->
|
||||
|
||||
<record id="line9_purchase" model="purchase.order.line">
|
||||
<field name="order_id" ref="requisition_order1"/>
|
||||
<field name="date_planned" eval="time.strftime('%Y/%m/%d')"/>
|
||||
<field name="name">[CPU1] Processor AMD Athlon XP 1800+</field>
|
||||
<field name="product_id" ref="product.product_product_cpu1"/>
|
||||
<field name="product_uom" ref="product.product_uom_unit"/>
|
||||
<field name="price_unit">60</field>
|
||||
<field name="product_qty">3</field>
|
||||
</record>
|
||||
|
||||
<record id="line10_purchase" model="purchase.order.line">
|
||||
<field name="order_id" ref="requisition_order2"/>
|
||||
<field name="date_planned" eval="time.strftime('%Y/%m/%d')"/>
|
||||
<field name="name">[CPU3] Processor AMD Athlon XP 2200+</field>
|
||||
<field name="product_id" ref="product.product_product_cpu3"/>
|
||||
<field name="product_uom" ref="product.product_uom_unit"/>
|
||||
<field name="price_unit">50</field>
|
||||
<field name="product_qty">13</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
-
|
||||
Create two PO on based of one tender,
|
||||
than confirm any one PO the second PO automatically goes in to cancel state.
|
||||
order_purchase_requisition1
|
||||
-
|
||||
In order to test the exclusive type requisition, I have to create two differ purchase order in one requisition [Tender]
|
||||
-
|
||||
I start by Checking the product, Product must have requisition field checked.
|
||||
-
|
||||
!record {model: product.product, id: product.product_product_cpu1}:
|
||||
purchase_requisition: True
|
||||
-
|
||||
Checking requisition field for another product.
|
||||
-
|
||||
!record {model: product.product, id: product.product_product_cpu3}:
|
||||
purchase_requisition: True
|
||||
-
|
||||
Now check that purchase order's product must have requisition field checked.
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
pur_order = self.pool.get('purchase.order')
|
||||
ids = pur_order.search(cr, uid, [('requisition_id','=',ref('order_purchase_requisition1'))])
|
||||
po_id = pur_order.browse(cr, uid, ids)
|
||||
for po in po_id:
|
||||
for line in po.order_line:
|
||||
if line.product_id.purchase_requisition == False:
|
||||
assert line.product_id.purchase_requisition == True, "Purchase Order's product must have requisition field checked"
|
||||
po_confirm = po_id[0].id
|
||||
wf_service.trg_validate(uid, 'purchase.order',po_confirm,'purchase_confirm', cr)
|
||||
assert po_id[0].state == 'approved',"After confirm a purchase order it should be in confirm state"
|
||||
assert po_id[1].state == 'cancel',"After confirmed a purchase order form the this requisition the second purchase order should be automatically goes in to cancelled state"
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue