[ADD]purchase: Add yml for Purchase Order cancel from Aproved state.

bzr revid: aag@tinyerp.com-20110728130800-ti3360jmmncbg8jh
This commit is contained in:
Atik Agewan (OpenERP)
2011-07-28 18:38:00 +05:30
parent 5b9d4e1c76
commit 9f104b52e3
2 changed files with 97 additions and 2 deletions
+3 -2
View File
@@ -65,8 +65,9 @@ Dashboard for purchase management that includes:
'purchase_unit_test.xml',
'test/procurement_buy.yml',
'test/purchase_report.yml',
'test/purchase_order_merge.yml'
],
'test/purchase_order_merge.yml',
'test/purchase_order_cancel_draft.yml'
],
'demo': ['purchase_demo.xml'],
'installable': True,
'active': False,
@@ -0,0 +1,94 @@
-
In order to test to Cancel purchase order from Approved State,I start by creating a new product 'Pen Drive1'
-
!record {model: product.product, id: product_product_pendrive1}:
categ_id: 'product.product_category_3'
cost_method: standard
mes_type: fixed
name: Pen Drive
price_margin: 1.0
procure_method: make_to_order
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
seller_delay: '1'
standard_price: 500.0
supply_method: buy
type: product
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
-
In order to test the purchase order flow,I create a new record where "invoice_method" is From Order.
-
I create first purchase order for Pen Drive1.
-
!record {model: purchase.order, id: purchase_order_pendrive1}:
company_id: base.main_company
date_order: !eval time.strftime('%Y-%m-%d')
invoice_method: order
location_id: stock.stock_location_stock
order_line:
- date_planned: !eval time.strftime('%Y-%m-%d')
name: Pen Drive
price_unit: 100.0
product_id: 'product_product_pendrive1'
product_qty: 10.0
product_uom: product.product_uom_unit
state: draft
partner_address_id: base.res_partner_address_7
partner_id: base.res_partner_4
pricelist_id: purchase.list0
-
Initially purchase order is in the draft state.
-
!assert {model: purchase.order, id: purchase_order_pendrive1}:
- state == 'draft'
-
I confirm the purchase order for Pen Drive1.
-
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_pendrive1}
-
I check that the order which was initially in the draft state has transmit to confirm state.
-
!assert {model: purchase.order, id: purchase_order_pendrive1}:
- state == 'approved'
-
I have to first cancel Picking of Approved Perchase order .
-
!python {model: stock.picking}: |
from tools.translate import _
pur_ord=self.pool.get( 'purchase.order')
name = pur_ord.browse(cr, uid, ref("purchase_order_pendrive1")).name
search_ids=self.search(cr, uid, [('origin', '=', name) ])
self.action_cancel(cr, uid, search_ids)
-
Now I have to cancel confirm purchase order for Pen Drive1.
-
!python {model: purchase.order}: |
from tools.translate import _
ids = []
ids.append(ref("purchase_order_pendrive1"))
self.action_cancel(cr, uid, ids)
-
I check that the order which was in approved state has transmit to cancel state.
-
!assert {model: purchase.order, id: purchase_order_pendrive1}:
- state == 'cancel'
-
Now again set purchase order for Pen Drive1 to draft state.
-
!python {model: purchase.order}: |
from tools.translate import _
ids = []
ids.append(ref("purchase_order_pendrive1"))
self.action_cancel_draft(cr, uid, ids)
-
I check that the order which was in cancel state has transmit to draft state.
-
!assert {model: purchase.order, id: purchase_order_pendrive1}:
- state == 'draft'